diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SemanticScuttle/Service/Bookmark.php | 6 | ||||
-rw-r--r-- | src/SemanticScuttle/Service/Bookmark2Tag.php | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 1315350..39ec4f0 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -734,7 +734,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService $tags = explode('+', trim($tags)); } - $tagcount = count($tags); + $tagcount = empty($tags) ? 0 : count($tags); for ($i = 0; $i < $tagcount; $i ++) { $tags[$i] = trim($tags[$i]); } @@ -853,7 +853,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService $aTerms = array_map('trim', $aTerms); // Search terms in tags as well when none given - if (!count($tags)) { + if (!empty($tags)) { $query_2 .= ' LEFT JOIN '. $b2tservice->getTableName() .' AS T' . ' ON B.bId = T.bId'; $dotags = true; @@ -1136,7 +1136,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService // Delete final / if (substr($address, -1) == '/') { - $address = substr($address, 0, count($address)-2); + $address = substr($address, 0, strlen($address)-2); } return $address; diff --git a/src/SemanticScuttle/Service/Bookmark2Tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php index a01b5d7..2579022 100644 --- a/src/SemanticScuttle/Service/Bookmark2Tag.php +++ b/src/SemanticScuttle/Service/Bookmark2Tag.php @@ -691,14 +691,12 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService } if ($sortOrder == 'alphabet_asc') { - usort($output, create_function('$a,$b','return strcasecmp(utf8_deaccent($a["tag"]), utf8_deaccent($b["tag"]));')); + usort($output, "cmp"); } return $output; } - - /** * Deletes all tags in bookmarks2tags * @@ -711,4 +709,10 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService } } + +function cmp($a,$b) +{ + return strcasecmp(utf8_deaccent($a["tag"]), utf8_deaccent($b["tag"])); +} + ?> |