]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Using a foreach loop avoids Notice warnings when the array doesn't have sequential...
authorRicardo Soares de Lima <ricardo.soaresdelima@gmail.com>
Sat, 8 Dec 2012 19:23:10 +0000 (17:23 -0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 21 Mar 2013 05:39:23 +0000 (06:39 +0100)
src/SemanticScuttle/Service/Bookmark2Tag.php
src/SemanticScuttle/Service/Tag.php

index 6505a5aa7f3ced75382acff283d5d6f60b30f3fb..6e8e28c7c1bbb1c1d79317e47c2dbebd09c660d4 100644 (file)
@@ -98,7 +98,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
 
         $tags_count = is_array($tags)?count($tags):0;
 
-        for ($i = 0; $i < $tags_count; $i++) {
+        foreach($tags as $i => $tag) {
             $tags[$i] = trim(utf8_strtolower($tags[$i]));
             if ($fromApi) {
                 include_once 'SemanticScuttle/functions.php';
index 39147b85dd1761bd2ae7efaaa250a816034282dd..bd6bf70cc77028197fd134b2ad5dde0fc3a47815 100644 (file)
@@ -144,7 +144,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
             $tags = utf8_strtolower(trim($tags));
         } else {
             $tags = array_filter($tags);//remove empty values
-            for($i=0; $i<count($tags); $i++) {
+            foreach($tags as $i => $tag) {
                 $tags[$i] = utf8_strtolower(trim($tags[$i]));
             }
         }