本文整理汇总了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;
}
示例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]]"><<</a></li>') . '`
&pageNextTpl=`' . $this->xpdo->getOption('pageNextTpl', $settings, '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">>></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;
}