diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-01-16 11:16:43 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-01-16 11:16:43 +0000 |
commit | 180e5a0fc617d9d5a7c516842d598adee0f2e049 (patch) | |
tree | eeaf22e3a293af968d815e0bb47df4e7f134b559 /src/SemanticScuttle | |
parent | 50f41d57f7a3fd557245be03e0bc54b37bd32da9 (diff) | |
download | semanticscuttle-180e5a0fc617d9d5a7c516842d598adee0f2e049.tar.gz semanticscuttle-180e5a0fc617d9d5a7c516842d598adee0f2e049.tar.bz2 |
Fix bug #2887063: Common tag combination description feels broken
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@598 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle')
-rw-r--r-- | src/SemanticScuttle/Service/CommonDescription.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/SemanticScuttle/Service/CommonDescription.php b/src/SemanticScuttle/Service/CommonDescription.php index 8acd254..39c5826 100644 --- a/src/SemanticScuttle/Service/CommonDescription.php +++ b/src/SemanticScuttle/Service/CommonDescription.php @@ -49,6 +49,8 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic } function addTagDescription($tag, $desc, $uId, $time) { + $tag = self::getSortedTag($tag); + // Check if no modification $lastDesc = $this->getLastTagDescription($tag); if($lastDesc['cdDescription'] == $desc) { @@ -70,6 +72,8 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic } function getLastTagDescription($tag) { + $tag = self::getSortedTag($tag); + $query = "SELECT *"; $query.= " FROM `". $this->getTableName() ."`"; $query.= " WHERE tag='".$tag."'"; @@ -200,5 +204,26 @@ class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_DbServic $this->db->sql_query($query); } + + + /** + * Sorts a tag combination. + * + * Multiple tags are separated by "+" signs. Semantically, + * tag combinations like "blue+flower" and "flower+blue" are identical. + * This method sorts the single tags so i.e. the common bookmark description + * of "blue+flower" is also shown for "flower+blue". + * + * @param string $tag Single tag or tag combination ("+") + * + * @return string Sorted tag combination + */ + protected static function getSortedTag($tag) + { + $tags = explode('+', $tag); + sort($tags); + return implode('+', $tags); + } + } ?> |