diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-04-02 02:01:53 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-04-17 04:44:35 +0300 |
commit | 2d721cf08386b16f75f979d962c81be7db1689d6 (patch) | |
tree | 016d6cc389ee9678dbace74ed7846770e856ae21 /core/DataTable/Filter/Pattern.php | |
parent | 3899b9a3b042f01dab7f9d65266883c796d9b996 (diff) |
refs #3838 use pagination in SitesManager to be able to manage many hundreds or thousands of sites
Diffstat (limited to 'core/DataTable/Filter/Pattern.php')
-rw-r--r-- | core/DataTable/Filter/Pattern.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/core/DataTable/Filter/Pattern.php b/core/DataTable/Filter/Pattern.php index 832fb856a2..1327b4f40a 100644 --- a/core/DataTable/Filter/Pattern.php +++ b/core/DataTable/Filter/Pattern.php @@ -23,6 +23,9 @@ use Piwik\DataTable\BaseFilter; */ class Pattern extends BaseFilter { + /** + * @var string|array + */ private $columnToFilter; private $patternToSearch; private $patternToSearchQuoted; @@ -93,4 +96,30 @@ class Pattern extends BaseFilter } } } + + /** + * See {@link Pattern}. + * + * @param array $array + * @return array + */ + public function filterArray($array) + { + $newArray = array(); + + foreach ($array as $key => $row) { + foreach ($this->columnToFilter as $column) { + if (!array_key_exists($column, $row)) { + continue; + } + + if (self::match($this->patternToSearchQuoted, $row[$column], $this->invertedMatch)) { + $newArray[$key] = $row; + continue 2; + } + } + } + + return $newArray; + } } |