/** * Prepare datas before save * * @see \ContentinumComponents\Mapper\Process::save() */ public function save($datas, $entity = null, $stage = '', $id = null) { $entity = $this->handleEntity($entity); if (null === $entity->getPrimaryValue()) { $filter = new \ContentinumComponents\Filter\Url\Prepare(); $datas['typescope'] = $filter->filter($datas['typescope']); unset($filter); parent::save($datas, $entity, $stage, $id); } else { $filter = new \ContentinumComponents\Filter\Url\Prepare(); $datas['typescope'] = $filter->filter($datas['typescope']); unset($filter); parent::save($datas, $entity, $stage, $id); } }
/** * * @param unknown $datas * @param unknown $id * @param unknown $group */ protected function assignTags($datas, $id, $group) { $assigns = array(); if (!empty($datas['contentTags'])) { $assigns = $datas['contentTags']; } if (isset($datas['newTags']) && strlen($datas['newTags']) > 1) { $newTags = explode(',', $datas['newTags']); $handleTags = new \Mcwork\Model\Blog\SaveTags($this->getStorage()); $handleTags->setEntity($this->getSl()->get('entity_tags')); $date = date('Y-m-d H:i:s'); $filter = new \ContentinumComponents\Filter\Url\Prepare(); foreach ($newTags as $tagName) { if (strlen($tagName) > 1) { $tagName = trim($tagName); $tagScope = $filter->filter($tagName); $entries = $this->fetchRow("SELECT * FROM web_tags WHERE tag_group = 'newsblogstags' AND tag_scope = '" . $tagScope . "'"); if (false === $entries) { $lastInsertId = $handleTags->sequence() + 1; $insert = array('id' => $lastInsertId, 'tag_name' => $tagName, 'tag_group' => 'newsblogstags', 'tag_scope' => $tagScope, 'created_by' => $this->getUserIdent(), 'update_by' => $this->getUserIdent(), 'register_date' => $date, 'up_date' => $date); $this->insertQuery('web_tags', $insert); $assigns[] = $lastInsertId; } else { $assigns[] = $entries['id']; } } } } if (!empty($assigns)) { $this->assignArticleTags($assigns, $id, $group); } return true; }
/** * Filter and prepare file and directory names before us in fs * * @param string $value * @return Ambigous <unknown, \Zend\Filter\mixed, mixed> */ public function filterNames($value) { $filter = new \ContentinumComponents\Filter\Url\Prepare(); $value = $filter->filter($value); unset($filter); return $value; }