本文整理匯總了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);
}