Changeset 1077 for trunk/common
- Timestamp:
- 12/13/09 19:17:05 (2 years ago)
- File:
-
- 1 edited
-
trunk/common/tags.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/tags.php
r1069 r1077 5 5 6 6 function tag_split($tag_data) { 7 $tags = explode(",", trim($tag_data)); 7 $tags = explode(",", $tag_data); 8 array_walk($tags, 'trim'); 8 9 $result = array(); 9 10 foreach ($tags as &$tag) { … … 30 31 } 31 32 32 function tag_build_list($obj, $obj_id, $type ) {33 function tag_build_list($obj, $obj_id, $type, $remove_prefix = true) { 33 34 $tag_list = tag_get($obj, $obj_id, $type); 34 35 $tag_names = array(); 35 36 foreach ($tag_list as $tag) { 36 $tag_names[] = $tag['tag_name']; 37 if ($remove_prefix) { 38 $tag_parts = explode('@', $tag['tag_name']); 39 $tag_names[] = trim($tag_parts[ count($tag_parts) - 1 ]); 40 } else { 41 $tag_names[] = $tag['tag_name']; 42 } 37 43 } 38 44 return implode(", ", $tag_names); 39 45 } 40 46 41 function tag_update($obj, $obj_id, $type, $tag_data ) {47 function tag_update($obj, $obj_id, $type, $tag_data, $tag_prefix = "") { 42 48 tag_clear($obj, $obj_id, $type); 43 49 $tag_data = tag_split($tag_data); 44 50 foreach ($tag_data as $tag_name) { 45 $tag_id = tag_assign_id(array("name" => $tag_ name, "type" => $type));51 $tag_id = tag_assign_id(array("name" => $tag_prefix.$tag_name, "type" => $type)); 46 52 tag_add($obj, $obj_id, $tag_id); 47 53 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)