コード例 #1
0
 public function writeEntry($title, $url, $description, $author = null, $taxonomies = array(), $collection = null)
 {
     if (!$collection) {
         $collection = $this->getConfig('collection');
     }
     $entry = Entry::create(Str::slug($title))->collection($collection)->order($this->getOrderPrefix($collection))->get();
     $entry->set('title', $title);
     if ($url) {
         $entry->set('link', $url);
     }
     // read default author if not passed in
     if (!$author) {
         $author = $this->getConfig('author');
     }
     $entry->set('author', User::whereUsername($author)->id());
     foreach ($taxonomies as $taxonomy => $terms) {
         if ($terms != null) {
             $entry->set($taxonomy, $this->getTermIds($taxonomy, $terms));
         }
     }
     $entry->content($description);
     $entry->save();
     // there may be UTF-8 spaces still left and I have no idea how to get rid of them
     // properly so this is an ugly hack
     //		$slug = str_replace("%C2%A0","-", urlencode($slug));
 }
コード例 #2
0
ファイル: SpockListener.php プロジェクト: than/spock
 /**
  * Get the concat'ed commands
  *
  * @return string
  */
 private function commands()
 {
     $full_path = Path::assemble(root_path(), $this->data->path());
     $data = $this->data->toArray();
     $data['full_path'] = $full_path;
     $data['committer'] = User::getCurrent()->toArray();
     $commands = [];
     foreach ($this->getConfig('commands', []) as $command) {
         $commands[] = Parse::template($command, $data);
     }
     return join('; ', $commands);
 }