Author: xavier
Date: 2010-02-02 18:11:40 +0100 (Tue, 02 Feb 2010)
New Revision: 27433
Modified:
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/TaggableToolkit.class.php
Log:
[wiki:sfDoctrineActAsTaggablePlugin]: filter tags array for empty tags
Modified:
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/TaggableToolkit.class.php
===================================================================
--- plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/TaggableToolkit.class.php
2010-02-02 17:02:55 UTC (rev 27432)
+++ plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/TaggableToolkit.class.php
2010-02-02 17:11:40 UTC (rev 27433)
@@ -21,7 +21,7 @@
public static function cleanTagName($tag, $options = array())
{
$tag = trim(rtrim(str_replace(',', ' ', $tag)));
-
+
if(isset($options['case']))
{
$tag = call_user_func($options['case'], $tag);
@@ -44,7 +44,7 @@
$tag = preg_replace('/\r?\n/', ',', $tag);
$tag = explode(',', $tag);
$tag = array_map('trim', $tag);
- $tag = array_map('rtrim', $tag);
+ $tag = array_filter(array_map('rtrim', $tag));
}
return $tag;
@@ -128,17 +128,17 @@
{
throw new Exception(sprintf('%s is not a doctrine class...',
$model));
}
-
+
if(is_string($model))
{
$table = Doctrine::getTable($model);
}
-
+
if(is_object($model))
{
$table = $model->getTable();
}
-
+
return $table->hasTemplate('Taggable');
}
@@ -172,11 +172,11 @@
return $tags;
}
-
+
/**
* Transform every $tagname in $tags to namespace:key=$tagname:
* array_walk($tags, 'TaggableToolkit::triplify', 'namespace:key');
- *
+ *
* @param String $tagname
* @param String $array_key
* @param String $ns_key
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.