Exemplo n.º 1
0
 function getValue($filtered = true)
 {
     $values = explode($this->separator, $this->_value);
     $tags = array();
     foreach ($values as &$value) {
         $value = trim($value);
         if ($value != '') {
             if ($this->_filter && $filtered) {
                 $value = call_user_func($this->_filter, $value, $this->getName());
             }
             $tags[] = $value;
         }
     }
     $ids = array();
     foreach ($tags as $tag) {
         $ds = new TableReader('blog_tag');
         $id = $ds->select('blog_tag_id')->where('tag', $tag)->fetchScalar();
         if (!$id) {
             $writer = new TableWriter('blog_tag');
             $id = $writer->insert(array('tag' => $tag, 'url_tag' => TextHelper::urlize($tag)));
         }
         $ids[] = $id;
     }
     return $ids;
 }
Exemplo n.º 2
0
 function insertRow($values)
 {
     $ds = new TableWriter($this->name);
     $id = $ds->insert($values);
     if ($id) {
         return array($this->primary[0] => $id);
     } else {
         return $id;
     }
 }