$tags = cot_tag_parse($rtags); $old_tags = cot_tag_list($id, 'projects', $tags_extra); $kept_tags = array(); $new_tags = array(); // Find new tags, count old tags that have been left $cnt = 0; foreach ($tags as $tag) { $p = array_search($tag, $old_tags); if ($p !== false) { $kept_tags[] = $old_tags[$p]; $cnt++; } else { $new_tags[] = $tag; } } // Remove old tags that have been removed $rem_tags = array_diff($old_tags, $kept_tags); foreach ($rem_tags as $tag) { cot_tag_remove($tag, $id, 'projects', $tags_extra); } // Add new tags $ncnt = count($new_tags); if ($cfg['plugin']['tags']['limit'] > 0 && $ncnt > $cfg['plugin']['tags']['limit'] - $cnt) { $lim = $cfg['plugin']['tags']['limit'] - $cnt; } else { $lim = $ncnt; } for ($i = 0; $i < $lim; $i++) { cot_tag($new_tags[$i], $id, 'projects', $tags_extra); } }
$tags = cot_tag_parse($rtags); $old_tags = cot_tag_list($id, 'pages', $tags_extra); $kept_tags = array(); $new_tags = array(); // Find new tags, count old tags that have been left $cnt = 0; foreach ($tags as $tag) { $p = array_search($tag, $old_tags); if ($p !== false) { $kept_tags[] = $old_tags[$p]; $cnt++; } else { $new_tags[] = $tag; } } // Remove old tags that have been removed $rem_tags = array_diff($old_tags, $kept_tags); foreach ($rem_tags as $tag) { cot_tag_remove($tag, $id, 'pages', $tags_extra); } // Add new tags $ncnt = count($new_tags); if ($cfg['plugin']['tags']['limit'] > 0 && $ncnt > $cfg['plugin']['tags']['limit'] - $cnt) { $lim = $cfg['plugin']['tags']['limit'] - $cnt; } else { $lim = $ncnt; } for ($i = 0; $i < $lim; $i++) { cot_tag($new_tags[$i], $id, 'pages', $tags_extra); } }
$tags = cot_tag_parse($rtags); $old_tags = cot_tag_list($id, 'market', $tags_extra); $kept_tags = array(); $new_tags = array(); // Find new tags, count old tags that have been left $cnt = 0; foreach ($tags as $tag) { $p = array_search($tag, $old_tags); if ($p !== false) { $kept_tags[] = $old_tags[$p]; $cnt++; } else { $new_tags[] = $tag; } } // Remove old tags that have been removed $rem_tags = array_diff($old_tags, $kept_tags); foreach ($rem_tags as $tag) { cot_tag_remove($tag, $id, 'market', $tags_extra); } // Add new tags $ncnt = count($new_tags); if ($cfg['plugin']['tags']['limit'] > 0 && $ncnt > $cfg['plugin']['tags']['limit'] - $cnt) { $lim = $cfg['plugin']['tags']['limit'] - $cnt; } else { $lim = $ncnt; } for ($i = 0; $i < $lim; $i++) { cot_tag($new_tags[$i], $id, 'market', $tags_extra); } }
$tags = cot_tag_parse($rtags); $old_tags = cot_tag_list($q, 'forums'); $kept_tags = array(); $new_tags = array(); // Find new tags, count old tags that have been left $cnt = 0; foreach ($tags as $tag) { $ps = array_search($tag, $old_tags); if ($ps !== false) { $kept_tags[] = $old_tags[$ps]; $cnt++; } else { $new_tags[] = $tag; } } // Remove old tags that have been removed $rem_tags = array_diff($old_tags, $kept_tags); foreach ($rem_tags as $tag) { cot_tag_remove($tag, $q, 'forums'); } // Add new tags $ncnt = count($new_tags); if ($cfg['plugin']['tags']['limit'] > 0 && $ncnt > $cfg['plugin']['tags']['limit'] - $cnt) { $lim = $cfg['plugin']['tags']['limit'] - $cnt; } else { $lim = $ncnt; } for ($i = 0; $i < $lim; $i++) { cot_tag($new_tags[$i], $q, 'forums'); } }
$tags = cot_tag_parse($rtags); $old_tags = cot_tag_list($id, 'folio', $tags_extra); $kept_tags = array(); $new_tags = array(); // Find new tags, count old tags that have been left $cnt = 0; foreach ($tags as $tag) { $p = array_search($tag, $old_tags); if ($p !== false) { $kept_tags[] = $old_tags[$p]; $cnt++; } else { $new_tags[] = $tag; } } // Remove old tags that have been removed $rem_tags = array_diff($old_tags, $kept_tags); foreach ($rem_tags as $tag) { cot_tag_remove($tag, $id, 'folio', $tags_extra); } // Add new tags $ncnt = count($new_tags); if ($cfg['plugin']['tags']['limit'] > 0 && $ncnt > $cfg['plugin']['tags']['limit'] - $cnt) { $lim = $cfg['plugin']['tags']['limit'] - $cnt; } else { $lim = $ncnt; } for ($i = 0; $i < $lim; $i++) { cot_tag($new_tags[$i], $id, 'folio', $tags_extra); } }