class_RegExpHelper.inc.php
3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* @file RegExpHelper.inc.php
* @category freeSN
* @mailto code [at] netz.coop
* @version 0.4.200901
* @link http://netz.coop
*
* @copyright Copyright by netz.coop e.G. 2015
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class RegExpHelper extends STAssertHelper {
/** Funktion wird aufgerufen um zu überprüfen ob für leseberechtigte die vollständigen generierten daten im CUrl output stehen
*
*/
public function searchRegExpInArray($param_site,$param_search_array,$param_rtn,$param_output = null) {
$ary_search = $this->prepareRegSearch($param_site,$param_search_array,$param_rtn);
$this->assertRegExpTests($ary_search,$param_rtn,null,$param_output);
return $param_rtn;
}
/** Funktion wird aufgerufen um zu überprüfen ob für nicht leseberechtigte die vollständigen generierten daten im CUrl output stehen
*
*/
public function searchForbiddenRegExpInArray($param_site,$param_search_array,$param_rtn,$param_output=null) {
$ary_search = $this->prepareRegSearch($param_site,$param_search_array,$param_rtn,TRUE);
$this->assertRegExpTests($ary_search,$param_rtn,'1',$param_output);
return $param_rtn;
}
/** Funktion bereitet die Suche vor um Fehleranfällige Angaben von den Tests auszuschließen und gibt den den Search Array zurück
*
*/
private function prepareRegSearch($param_site,$param_search_array,$param_rtn,$param_Forbidden = false) {
$ary_search = array();
if($param_Forbidden === false) {
unset($param_search_array['WritePrivate']);
unset($param_search_array['Submit']);
unset($param_search_array['addToLinkList']);
unset($param_search_array['Url']);
unset($param_search_array['Avatar']);
if(isset($param_testarray['PartOfID'])){
unset($param_testarray['PartOfID']);
}
$param_search_array['TagName'] = $param_rtn[$param_rtn['cur']['MCase']][$param_rtn['cur']['BC']][$param_rtn['cur']['MT']]['TagName'];
}
foreach($param_search_array as $var_key => $var_value) {
if($var_value != null && !is_int($var_value) && !is_array($var_value) ) {
$ary_search[$var_key][$var_value][] = RegExpTools::newsearchTextOutput($param_site,$var_value);
}
}
return $ary_search;
}
public function searchRegExpInTagCategory($param_site,$param_search_array,$param_rtn=null) {
$ary_search = $this->prepareRegSearchTagCategory($param_site,$param_search_array,$param_rtn=null);
return $ary_search;
}
private function prepareRegSearchTagCategory($param_site,$param_search_array,$param_rtn = null) {
$ary_search = array();
foreach($param_search_array as $var_key => $var_value) {
if($var_value != null && !is_int($var_value) && !is_array($var_value) ) {
$ary_search[$var_key][$var_value][] = RegExpTools::newsearchTextOutput($param_site,$var_value);
}
}
return $ary_search;
}
}
?>