mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Misc/Util
* relax numeric type requirements when working with filters * restore smart type casting functionality of Util::checkNumeric when used with NUM_ANY * enable Util::arraySumByKey to work recursively * fix source display in listview
This commit is contained in:
@@ -393,7 +393,7 @@ class CreatureListFilter extends Filter
|
||||
if (!$this->parentCats || $this->parentCats[0] != 1)
|
||||
return false;
|
||||
|
||||
if (!Util::checkNumeric($val, NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($val, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
$type = FILTER_V_LIST;
|
||||
@@ -518,7 +518,7 @@ class CreatureListFilter extends Filter
|
||||
|
||||
protected function cbFaction($cr)
|
||||
{
|
||||
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
if (!in_array($cr[1], $this->enums[$cr[0]]))
|
||||
|
||||
@@ -2503,7 +2503,7 @@ class ItemListFilter extends Filter
|
||||
|
||||
protected function cbDisenchantsInto($cr)
|
||||
{
|
||||
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
if (!in_array($cr[1], $this->enums[$cr[0]]))
|
||||
@@ -2620,7 +2620,7 @@ class ItemListFilter extends Filter
|
||||
if (!$this->parentCats)
|
||||
return false;
|
||||
|
||||
if (!Util::checkNumeric($v, NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($v, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
$c = $this->parentCats;
|
||||
@@ -2650,7 +2650,7 @@ class ItemListFilter extends Filter
|
||||
|
||||
protected function cbSlotCheck(&$v)
|
||||
{
|
||||
if (!Util::checkNumeric($v, NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($v, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
// todo (low): limit to concrete slots
|
||||
|
||||
@@ -557,7 +557,7 @@ class QuestListFilter extends Filter
|
||||
|
||||
protected function cbReputation($cr, $sign)
|
||||
{
|
||||
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
if (!in_array($cr[1], $this->enums[$cr[0]]))
|
||||
@@ -593,7 +593,7 @@ class QuestListFilter extends Filter
|
||||
|
||||
protected function cbCurrencyReward($cr)
|
||||
{
|
||||
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
if (!in_array($cr[1], $this->enums[$cr[0]]))
|
||||
@@ -672,7 +672,7 @@ class QuestListFilter extends Filter
|
||||
|
||||
protected function cbEarnReputation($cr)
|
||||
{
|
||||
if (!Util::checkNumeric($cr[1], NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
if ($cr[1] == FILTER_ENUM_ANY) // any
|
||||
|
||||
@@ -2678,7 +2678,7 @@ class SpellListFilter extends Filter
|
||||
if (!$this->parentCats || !in_array($this->parentCats[0], [-13, -2, 7]))
|
||||
return false;
|
||||
|
||||
if (!Util::checkNumeric($val, NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($val, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
$type = FILTER_V_LIST;
|
||||
@@ -2692,7 +2692,7 @@ class SpellListFilter extends Filter
|
||||
if (!$this->parentCats || $this->parentCats[0] != -13)
|
||||
return false;
|
||||
|
||||
if (!Util::checkNumeric($val, NUM_REQ_INT))
|
||||
if (!Util::checkNumeric($val, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
$type = FILTER_V_LIST;
|
||||
|
||||
Reference in New Issue
Block a user