코드 병합

This commit is contained in:
2018-09-29 22:37:30 +09:00
38 changed files with 831 additions and 150 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ class StringUtil
public static function removeSpecialCharacter($str)
{
return str_replace([
'"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', '\\', '/', '`', '#',
'"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', 'ⓞ', 'ⓧ', '㉥', '\\', '/', '`', '#',
'-', '#', '|'
], '', $str);
}
+18
View File
@@ -60,6 +60,24 @@ class Util extends \utilphp\util
throw new \InvalidArgumentException('올바르지 않은 type 지정');
}
public static function zip(iterable ...$iterators){
while(true){
$hasValue = false;
$values = [];
foreach($iterators as $iter){
if($iter->valid()){
$values[] = $iter->send(NULL);
$hasValue = true;
}
}
yield $values;
if(!$hasValue){
break;
}
}
}
/**
* $_POST, $_GET에서 값을 가져오는 함수. Util::array_get($_POST[$name])을 축약 가능.
* 타입이 복잡해질 경우 이 함수를 통하지 않고 json으로 요청할 것을 권장.
+6 -1
View File
@@ -132,16 +132,21 @@ class WebUtil
}
$config = \HTMLPurifier_HTML5Config::createDefault();
$def = $config->getHTMLDefinition();
$def->info_global_attr['data-flip'] = new \HTMLPurifier_AttrDef_Text;
$purifier = new \HTMLPurifier($config);
return $purifier->purify($text);
}
public static function drawMenu(string $path): string{
if(!file_exists($path)){
return '';
}
$json = Json::decode(file_get_contents($path));
$result = [];
foreach($json as $menuItem){
if (count($path) == 2) {
if (count($menuItem) == 2) {
[$url, $title] = $menuItem;
$targetAttr = '';
}