本文整理匯總了PHP中JCckDatabase::quote方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCckDatabase::quote方法的具體用法?PHP JCckDatabase::quote怎麽用?PHP JCckDatabase::quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCckDatabase
的用法示例。
在下文中一共展示了JCckDatabase::quote方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onCCK_StoragePrepareSearch
public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target, $fields = array(), &$config = array())
{
$sql = '';
switch ($match) {
case 'exact':
$sql = $target . ' = ' . JCckDatabase::quote($value);
break;
case 'empty':
$sql = $target . ' = ""';
break;
case 'alpha':
$sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
break;
case 'zeta':
/* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
$sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
break;
case 'any':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') OR (', $fragments) . '))';
}
}
break;
case 'any_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
$var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
if (!$var_type) {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $v;
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = JCckDatabase::quote($v);
}
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
break;
case 'each':
case 'each_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
if ($match == 'each_exact') {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' = ' . JCckDatabase::quote($v) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true) . $separator . '%', false) . ' OR ' . $target . ' LIKE ' . JCckDatabase::quote('%' . $separator . JCckDatabase::escape($v, true), false);
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
}
if (count($fragments)) {
$sql = '((' . implode(') AND (', $fragments) . '))';
}
}
break;
case 'date_past_only':
$sql = $target . ' < ' . JCckDatabase::quote($value);
break;
case 'date_past':
$sql = $target . ' <= ' . JCckDatabase::quote($value);
break;
case 'date_future':
$sql = $target . ' >= ' . JCckDatabase::quote($value);
break;
case 'date_future_only':
$sql = $target . ' > ' . JCckDatabase::quote($value);
break;
case 'nested_exact':
$table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
$column = 'id';
$values = JCckDevHelper::getBranch($table, $value);
if ($column != 'id') {
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
//.........這裏部分代碼省略.........
示例2: _setTaxes
protected static function _setTaxes($zones)
{
$db = JFactory::getDbo();
$null = $db->getNullDate();
$now = JFactory::getDate()->toSql();
$zones[] = 0;
$query = 'SELECT a.id, a.title, a.type, a.tax, a.tax_amount, a.groups, a.target' . ' FROM #__cck_more_ecommerce_taxes AS a' . ' LEFT JOIN #__cck_more_ecommerce_zone_tax AS b ON b.tax_id = a.id' . ' WHERE a.published = 1' . ' AND (a.publish_up = ' . JCckDatabase::quote($null) . ' OR ' . 'a.publish_up <= ' . JCckDatabase::quote($now) . ')' . ' AND (a.publish_down = ' . JCckDatabase::quote($null) . ' OR ' . 'a.publish_down >= ' . JCckDatabase::quote($now) . ')' . ' AND b.zone_id IN (' . implode(',', $zones) . ')' . ' ORDER BY a.title';
$taxes = JCckDatabase::loadObjectListArray($query, 'type');
return $taxes;
}
示例3: onCCK_StoragePrepareSearch
public static function onCCK_StoragePrepareSearch(&$field, $match, $value, $name, $name2, $target)
{
$sql = '';
switch ($match) {
case 'exact':
$sql = $target . ' = ' . JCckDatabase::quote($value);
break;
case 'alpha':
$sql = $target . ' LIKE ' . JCckDatabase::quote(JCckDatabase::escape($value, true) . '%', false);
break;
case 'zeta':
/* Zeta is not the last letter of Greek alphabet but.. this won't be an issue here. */
$sql = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($value, true), false);
break;
case 'any':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') OR (', $fragments) . '))';
}
}
break;
case 'any_exact':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
$var_type = $field->match_options ? $field->match_options->get('var_type', 1) : 1;
if (!$var_type) {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $v;
}
}
} else {
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = JCckDatabase::quote($v);
}
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
break;
case 'each':
$separator = $field->match_value ? $field->match_value : ' ';
$values = explode($separator, $value);
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if (strlen($v) > 0) {
$fragments[] = $target . ' LIKE ' . JCckDatabase::quote('%' . JCckDatabase::escape($v, true) . '%', false);
}
}
if (count($fragments)) {
$sql = '((' . implode(') AND (', $fragments) . '))';
}
}
break;
case 'date_past_only':
$sql = $target . ' < ' . JCckDatabase::quote($value);
break;
case 'date_past':
$sql = $target . ' <= ' . JCckDatabase::quote($value);
break;
case 'date_future':
$sql = $target . ' >= ' . JCckDatabase::quote($value);
break;
case 'date_future_only':
$sql = $target . ' > ' . JCckDatabase::quote($value);
break;
case 'nested_exact':
$table = $field->match_options ? $field->match_options->get('table', $field->storage_table) : $field->storage_table;
$column = 'id';
$values = JCckDevHelper::getBranch($table, $value);
if ($column != 'id') {
if (count($values)) {
$fragments = array();
foreach ($values as $v) {
if ($v != '') {
$fragments[] = JCckDatabase::quote($v);
}
}
if (count($fragments)) {
$sql = $target . ' IN (' . implode(',', $fragments) . ')';
}
}
} else {
if (count($values)) {
$sql = $target . ' IN (' . implode(',', $values) . ')';
}
//.........這裏部分代碼省略.........