本文整理汇总了PHP中WoW::GetFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP WoW::GetFilters方法的具体用法?PHP WoW::GetFilters怎么用?PHP WoW::GetFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoW
的用法示例。
在下文中一共展示了WoW::GetFilters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFilterForNPCs
private static function GetFilterForNPCs()
{
$filter_string = null;
$andOr = 1;
$all_filters = WoW::GetFilters();
if (is_array($all_filters)) {
foreach ($all_filters as $filter) {
if (!isset($filter['key']) || !isset($filter['values'])) {
continue;
}
$val_count = count($filter['values']);
switch ($filter['key']) {
// Family
case 'fa':
if ($val_count == 1) {
$filter_string .= '{COND} `a`.`family` = ' . $filter['values'][0];
} else {
$filter_string .= '{COND} `a`.`family` IN (';
self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
}
break;
}
}
}
return str_replace('{COND}', $andOr == 2 ? 'OR' : 'AND', $filter_string);
}
示例2: GetFiltersForItems
private static function GetFiltersForItems()
{
$filter_string = null;
$andOr = 1;
$all_filters = WoW::GetFilters();
if (is_array($all_filters)) {
foreach ($all_filters as $filter) {
if (!isset($filter['key']) || !isset($filter['values'])) {
continue;
}
$val_count = count($filter['values']);
switch ($filter['key']) {
// Name
case 'na':
if (WoW_Locale::GetLocaleID() > 0) {
$filter_string .= sprintf(" {COND} ((`b`.`name_loc%d` LIKE '%s') OR (`a`.`name` LIKE '%s'))", WoW_Locale::GetLocaleID(), '%' . $filter['values'][0] . '%', '%' . $filter['values'][0] . '%');
} else {
$filter_string .= sprintf("' {COND} `a`.`name` LIKE '%s'", '%' . $filter['values'][0] . '%');
}
break;
// Quality
// Quality
case 'qu':
if ($val_count == 1) {
$filter_string .= sprintf(' {COND} `a`.`Quality` = %d', $filter['values'][0]);
} else {
$filter_string .= ' {COND} `a`.`Quality` IN ( ';
self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
}
break;
// Min item level
// Min item level
case 'minle':
$filter_string .= sprintf(' {COND} `a`.`ItemLevel` >= %d', $filter['values'][0]);
break;
// Max item level
// Max item level
case 'maxle':
$filter_string .= sprintf(' {COND} `a`.`ItemLevel` <= %d', $filter['values'][0]);
break;
// At least one?
// At least one?
case 'ma':
if ($filter['values'][0] == 1) {
$andOr = 2;
}
break;
// Min req level
// Min req level
case 'minrl':
$filter_string .= sprintf(' {COND} `a`.`RequiredLevel` >= %d', $filter['values'][0]);
break;
// Max req level
// Max req level
case 'maxrl':
$filter_string .= sprintf(' {COND} `a`.`RequiredLevel` <= %d', $filter['values'][0]);
break;
// Slot
// Slot
case 'sl':
if ($val_count == 1) {
$filter_string .= sprintf(' {COND} `a`.`InventoryType` = %d', $filter['values'][0]);
WoW_Template::SetPageData('breadcrumb', WoW_Template::GetPageData('breadcrumb') . ',' . $filter['values'][0]);
} else {
$filter_string .= ' {COND} `a`.`InventoryType` IN( ';
self::ApplyMultiFiltersToString($val_count, $filter, $filter_string);
}
break;
// Side
// Side
case 'si':
switch ($filter['values'][0]) {
case -1:
// Alliance only
$filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE);
break;
case 1:
// Alliance
$filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_ALLIANCE);
break;
case -2:
// Horde only
$filter_string .= ' {COND} `a`.`AllowableRace` = ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE);
break;
case 2:
// Horde
$filter_string .= ' {COND} `a`.`AllowableRace` & ' . WoW_Utils::GetFactionBitMaskByFactionId(FACTION_HORDE);
break;
default:
// Skip "3" - useable by all
break;
}
break;
// Useable by class ID
// Useable by class ID
case 'ub':
if (!($filter['values'][0] < CLASS_WARRIOR) && !($filter['values'][0] >= MAX_CLASSES)) {
$filter_string .= ' {COND} `a`.`AllowableClass` & ' . WoW_Utils::GetClassBitMaskByClassId($filter['values'][0]);
}
break;
//.........这里部分代码省略.........