mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Fix #872 remove weird characters from tags
This commit is contained in:
parent
4bc0a14dd1
commit
094f1bf0d1
2 changed files with 18 additions and 14 deletions
|
|
@ -142,7 +142,7 @@ class documentItem extends Object
|
||||||
if($this->get('tags'))
|
if($this->get('tags'))
|
||||||
{
|
{
|
||||||
$tag_list = explode(',', $this->get('tags'));
|
$tag_list = explode(',', $this->get('tags'));
|
||||||
$tag_list = array_map('trim', $tag_list);
|
$tag_list = array_map('utf8_trim', $tag_list);
|
||||||
$this->add('tag_list', $tag_list);
|
$this->add('tag_list', $tag_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,24 @@ class tagController extends tag
|
||||||
{
|
{
|
||||||
if(!$obj->tags) return new Object();
|
if(!$obj->tags) return new Object();
|
||||||
// tags by variable
|
// tags by variable
|
||||||
|
$arranged_tag_list = array();
|
||||||
$tag_list = explode(',', $obj->tags);
|
$tag_list = explode(',', $obj->tags);
|
||||||
$tag_count = count($tag_list);
|
|
||||||
$tag_list = array_unique($tag_list);
|
|
||||||
if(!count($tag_list)) return new Object();
|
|
||||||
|
|
||||||
foreach($tag_list as $tag)
|
foreach($tag_list as $tag)
|
||||||
{
|
{
|
||||||
if(!trim($tag)) continue;
|
$tag = utf8_trim(utf8_normalize_spaces($tag));
|
||||||
$arranged_tag_list[] = trim($tag);
|
if($tag)
|
||||||
|
{
|
||||||
|
$arranged_tag_list[$tag] = $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!count($arranged_tag_list))
|
||||||
|
{
|
||||||
|
$obj->tags = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$obj->tags = implode(',', $arranged_tag_list);
|
||||||
}
|
}
|
||||||
if(!count($arranged_tag_list)) $obj->tags = null;
|
|
||||||
else $obj->tags = implode(',',$arranged_tag_list);
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,11 +61,9 @@ class tagController extends tag
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
||||||
$tag_list = explode(',', $tags);
|
$tag_list = explode(',', $tags);
|
||||||
$tag_count = count($tag_list);
|
foreach($tag_list as $tag)
|
||||||
for($i=0;$i<$tag_count;$i++)
|
|
||||||
{
|
{
|
||||||
unset($args->tag);
|
$args->tag = utf8_trim(utf8_normalize_spaces($tag));
|
||||||
$args->tag = trim($tag_list[$i]);
|
|
||||||
if(!$args->tag) continue;
|
if(!$args->tag) continue;
|
||||||
$output = executeQuery('tag.insertTag', $args);
|
$output = executeQuery('tag.insertTag', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue