示例#1
0
文件: Query.php 项目: kanso-cms/cms
 /**
  * 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 '';
 }
示例#2
0
文件: Article.php 项目: kanso-cms/cms
 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;
     }
 }