本文整理汇总了PHP中JDatabaseQuery::Quote方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseQuery::Quote方法的具体用法?PHP JDatabaseQuery::Quote怎么用?PHP JDatabaseQuery::Quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseQuery
的用法示例。
在下文中一共展示了JDatabaseQuery::Quote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processFilters
/**
* Process the query filters.
*
* @param JDatabaseQuery $query The query object.
* @param array $filters The filters values.
*
* @return JDatabaseQuery The db query object.
*/
protected function processFilters(\JDatabaseQuery $query, $filters = array())
{
$user = $this->container->get('user');
$db = $this->container->get('db');
$date = $this->container->get('date');
// If no state filter, set published >= 0
if (!isset($filters['user.state']) && property_exists($this->getTable(), 'state')) {
$query->where($query->quoteName('user.state') . ' >= 0');
}
// Category
// =====================================================================================
$category = $this->getCategory();
if ($category->id != 1 && in_array('category.lft', $this->filterFields) && in_array('category.rgt', $this->filterFields)) {
$query->where($query->format('(%n >= %a AND %n <= %a)', 'category.lft', $category->lft, 'category.rgt', $category->rgt));
}
// Max Level
// =====================================================================================
$maxLevel = $this->state->get('filter.max_category_levels', -1);
if ($maxLevel > 0) {
$query->where($query->quoteName('category.level') . " <= " . $maxLevel);
}
// Edit Access
// =====================================================================================
if ($this->state->get('filter.unpublished')) {
$query->where('user.state >= 0');
} else {
$query->where('user.state > 0');
$nullDate = $query->Quote($db->getNullDate());
$nowDate = $query->Quote($date->toSQL(true));
if (in_array('user.publish_up', $this->filterFields) && in_array('user.publish_down', $this->filterFields)) {
$query->where('(user.publish_up = ' . $nullDate . ' OR user.publish_up <= ' . $nowDate . ')');
$query->where('(user.publish_down = ' . $nullDate . ' OR user.publish_down >= ' . $nowDate . ')');
}
}
// View Level
// =====================================================================================
if ($access = $this->state->get('filter.access') && in_array('user.access', $this->filterFields)) {
$query->where(new InCompare('user.access', $user->getAuthorisedViewLevels()));
}
// Language
// =====================================================================================
if ($this->state->get('filter.language') && in_array('a.language', $this->filterFields)) {
$lang_code = $db->quote(JFactory::getLanguage()->getTag());
$query->where("a.language IN ('{$lang_code}', '*')");
}
return parent::processFilters($query, $filters);
}