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


PHP modX::sanitizeString方法代码示例

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


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

示例1: getSearchResults

 /**
  * Gets a modResource collection that matches the search terms
  *
  * @param string $str The string to use to search with.
  * @param array $scriptProperties
  * @return array An array of modResource results of the search.
  */
 public function getSearchResults($str = '', array $scriptProperties = array())
 {
     if (!empty($str)) {
         $this->searchString = strip_tags($this->modx->sanitizeString($str));
     }
     $this->loadDriver($scriptProperties);
     $this->response = $this->driver->search($str, $scriptProperties);
     $this->searchResultsCount = $this->response['total'];
     $this->docs = $this->response['results'];
     return $this->response;
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:18,代码来源:simplesearch.class.php

示例2: getPostListingCall

    /**
     * Get the getPage and getArchives call to display listings of posts on the container.
     *
     * @param string $placeholderPrefix
     * @return string
     */
    public function getPostListingCall($placeholderPrefix = '')
    {
        $settings = $this->getContainerSettings();
        $where = array('class_key' => 'Article');
        if (!empty($_REQUEST['arc_user'])) {
            $userPk = $this->xpdo->sanitizeString($_REQUEST['arc_user']);
            if (intval($userPk) == 0) {
                /** @var modUser $user */
                $user = $this->xpdo->getObject('modUser', array('username' => $userPk));
                if ($user) {
                    $userPk = $user->get('id');
                } else {
                    $userPk = false;
                }
            }
            if ($userPk !== false) {
                $where['createdby:='] = $userPk;
                $this->set('cacheable', false);
            }
        }
        $output = '[[!getPage?
          &elementClass=`modSnippet`
          &element=`getArchives`
          &makeArchive=`0`
          &cache=`1`
          &parents=`' . $this->get('id') . '`
          &where=`' . $this->xpdo->toJSON($where) . '`
          &showHidden=`1`
          &includeContent=`1`
          &includeTVs=`' . $this->xpdo->getOption('archivesIncludeTVs', $settings, 0) . '`
          &includeTVsList=`' . $this->xpdo->getOption('includeTVsList', $settings, '') . '`
          &processTVs=`' . $this->xpdo->getOption('archivesProcessTVs', $settings, 0) . '`
          &processTVsList=`' . $this->xpdo->getOption('processTVsList', $settings, '') . '`
          &tagKey=`articlestags`
          &tagSearchType=`contains`
          &sortby=`' . $this->xpdo->getOption('sortBy', $settings, 'publishedon') . '`
          &sortdir=`' . $this->xpdo->getOption('sortDir', $settings, 'DESC') . '`
          &tpl=`' . $this->xpdo->getOption('tplArticleRow', $settings, 'sample.ArticleRowTpl') . '`

          &limit=`' . $this->xpdo->getOption('articlesPerPage', $settings, 10) . '`
          &pageLimit=`' . $this->xpdo->getOption('pageLimit', $settings, 5) . '`
          &pageVarKey=`' . $this->xpdo->getOption('pageVarKey', $settings, 'page') . '`
          &pageNavVar=`' . $this->xpdo->getOption('pageNavVar', $settings, 'page.nav') . '`
          &totalVar=`' . $this->xpdo->getOption('pageTotalVar', $settings, 'total') . '`
          &offset=`' . $this->xpdo->getOption('pageOffset', $settings, 0) . '`

          &pageNavTpl=`' . $this->xpdo->getOption('pageNavTpl', $settings, '<li[[+classes]]><a[[+classes]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>') . '`
          &pageActiveTpl=`' . $this->xpdo->getOption('pageActiveTpl', $settings, '<li[[+activeClasses]]><a[[+activeClasses:default=` class="active"`]][[+title]] href="[[+href]]">[[+pageNo]]</a></li>') . '`
          &pageFirstTpl=`' . $this->xpdo->getOption('pageFirstTpl', $settings, '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First</a></li>') . '`
          &pageLastTpl=`' . $this->xpdo->getOption('pageLastTpl', $settings, '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last</a></li>') . '`
          &pagePrevTpl=`' . $this->xpdo->getOption('pagePrevTpl', $settings, '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">&lt;&lt;</a></li>') . '`
          &pageNextTpl=`' . $this->xpdo->getOption('pageNextTpl', $settings, '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">&gt;&gt;</a></li>') . '`

          ' . $this->xpdo->getOption('otherGetArchives', $settings, '') . '
        ]]';
        $this->xpdo->setPlaceholder($placeholderPrefix . 'articles', $output);
        $this->xpdo->setPlaceholder($placeholderPrefix . 'paging', '[[!+page.nav:notempty=`
<div class="paging">
<ul class="pageList">
  [[!+page.nav]]
</ul>
</div>
`]]');
        return $output;
    }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:71,代码来源:articlescontainer.class.php


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