@@ 56-69 (lines=14) @@ | ||
53 | * @return array all SilverstripePages that match the regex |
|
54 | * |
|
55 | */ |
|
56 | public static function filterPagesByModules(array $sspages, $filterRegex) |
|
57 | { |
|
58 | $arr = array(); |
|
59 | foreach ($sspages as $sspage) { |
|
60 | if (!$sspage instanceof SilverstripePage) { |
|
61 | continue; |
|
62 | } |
|
63 | if ($sspage->hasModule("/$filterRegex/")) { |
|
64 | array_push($arr, $sspage); |
|
65 | } |
|
66 | } |
|
67 | ||
68 | return $arr; |
|
69 | } |
|
70 | ||
71 | ||
72 | /** |
|
@@ 77-90 (lines=14) @@ | ||
74 | * @param string $env environment type dev OR live OR test |
|
75 | * @return array all SilverstripePages that have environment_type $env |
|
76 | */ |
|
77 | public static function filterPagesByEnvironmentType($sspages, $env) { |
|
78 | $arr = array(); |
|
79 | if(preg_match("/^(dev|test|live)$/",$env) === 1){ |
|
80 | foreach ($sspages as $sspage) { |
|
81 | if (!$sspage instanceof SilverstripePage) { |
|
82 | continue; |
|
83 | } |
|
84 | if ($env === $sspage->getEnvironmentType()) { |
|
85 | array_push($arr, $sspage); |
|
86 | } |
|
87 | } |
|
88 | } |
|
89 | return $arr; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * @param array $sspages |
|
@@ 98-110 (lines=13) @@ | ||
95 | * |
|
96 | * @return array all SilverstripePages where the version string matches $filterRegex |
|
97 | */ |
|
98 | public static function filterPagesByVersion($sspages, $filterRegex) { |
|
99 | $arr = array(); |
|
100 | foreach ($sspages as $sspage) { |
|
101 | if (!$sspage instanceof SilverstripePage) { |
|
102 | continue; |
|
103 | } |
|
104 | if (preg_match("/$filterRegex/",$sspage->getVersion())) { |
|
105 | array_push($arr, $sspage); |
|
106 | } |
|
107 | } |
|
108 | ||
109 | return $arr; |
|
110 | } |
|
111 | ||
112 | /** |
|
113 | * @param SilverstripePage[] $sspages |