/** * The tags * * @param int $post_id (optional) * @return string */ public function the_tags_list($post_id = null) { if ($post_id) { $post = $this->getPostByID($post_id); if ($post) { return \Kanso\Utility\Arr::implodeByKey('name', $post->tags, ', '); } return ''; } if (!empty($this->post)) { return \Kanso\Utility\Arr::implodeByKey('name', $this->post->tags, ', '); } return ''; }
public function save() { # Initialize joins if they have not been already $this->getTheCategory(); $this->getTheTags(); $this->getTheAuthor(); $this->getTheContent(); # Get the bookkeeper $bookkeeper = \Kanso\Kanso::getInstance()->Bookkeeper; # Update Kanso's static pages if the status has changed # and/or the article type has changed if ($this->row['status'] !== $this->tmpRow['status'] && isset($this->row['id'])) { $bookkeeper->changeStatus($this->row['id'], $this->tmpRow['status']); } # If no updates are required return; if ($this->tmpRow === $this->row && isset($this->row['id'])) { return; } # Save the article $save = $bookkeeper->saveArticle(array_merge($this->row, $this->tmpRow)); # Merge the results if ($save) { $save['tags'] = \Kanso\Utility\Arr::implodeByKey('name', $save['tags'], ', '); $this->tmpRow = array_merge($this->tmpRow, $save); $this->row = array_merge($this->row, $save); return true; } else { return false; } }