Create a new post.

@param  string  $title
@param  string  $content
@param  string  $slug
@param  array  $tags
@param  bool  $active
@param  int  $user_id
@param  DateTime  $publish_date
@return Post
178394
public function create($title, $content, $slug, array $tags, $active, $user_id, DateTime $publish_date)
	{
		$post = Post::create(compact('title', 'content', 'slug', 'active', 'user_id', 'publish_date'));

		$post->tags()->delete();

		$post->tags()->createMany($this->prepareTags($tags));

		return $post;
	}
86135
public function withSimpleCard($title, $content) {
		$this->getResponse()->setCard(new SimpleCard($title, $content));

		return $this;
	}
923697
public static function create(string $title, string $link, string $description): self
    {
        return new self($title, $link, $description);
    }
72174
public function view($content, $title = null)
    {
        return $this->app[AdminController::class]->renderContent($content, $title);
    }
393616
public function createResponse($content = null, array $headers = [])
    {
        $config = $this->responseConfig;
        if (!isset($config['class'])) {
            $config['class'] = Response::className();
        }
        $config['client'] = $this;
        $response = Yii::createObject($config);
        $response->setContent($content);
        $response->setHeaders($headers);
        return $response;
    }
974004
public function iShouldSeeAnIntroductionOfBlogPost($title)
    {
        $post = $this->findPostByTitle($title);
        $excerpt = str_replace('"', '\\"', $post['post_content']);
        $excerptBeforeMore = substr($excerpt, 0, strpos($excerpt, '<!--more-->'));
        $excerptAfterMore = substr($excerpt, strpos($excerpt, '<!--more-->'));

        return array(
            new Then(sprintf('I should see "%s" as an excerpt of the "%s" blog post', $excerptBeforeMore, $title)),
            new Then(sprintf('I should not see "%s" as an excerpt of the "%s" blog post', $excerptAfterMore, $title))
        );
    }
450961
public function createApp($hub, $title, $maxUsers = null, $noAutoKickUser = null)
    {
        $params['hub'] = $hub;
        $params['title'] = $title;
        if (!empty($maxUsers)) {
            $params['maxUsers'] = $maxUsers;
        }
        if (!empty($noAutoKickUser)) {
            $params['noAutoKickUser'] = $noAutoKickUser;
        }
        $body = json_encode($params);
        $ret = $this->post($this->baseURL, $body);
        return $ret;
    }
96064
public function tab($title, Closure $content, $active = false)
    {
        $this->getTab()->append($title, $content, $active);

        return $this;
    }
375568
public function create(string $content, $url, array $attributes = []) : string
    {
        return $this->make(new HrefSettings([
            'content'   => $content,
            'url'       => $url,
            'attributes'=> $attributes,
        ]));
    }
202343
public function addTitleToBody(string $content, string $tag = 'h4') : Bootstrap4Card
    {
        $this->body_sections[] = [
            'type' => 'title',
            'tag' => $tag,
            'content' => $content
        ];

        return $this;
    }
479993
private function createDummyContent()
    {
        $this->info("Creating default roles...");
        UserGroup::createDefaultRoles();
        $this->advanceBar();

        $this->info("Creating admin user...");
        $this->createAdminUser();
        $this->advanceBar();

        // Create Default Language
        $this->info("Creating default language...");
        factory(\App\Models\Language::class)->create(
            [
            'name' => $this->PRIMARY_LANGUAGE->name,
            'nativeName' => $this->PRIMARY_LANGUAGE->nativeName,
            'slug' => $this->PRIMARY_LANGUAGE->slug,
            'isDefault' => true
            ]
        );
        $this->advanceBar();

        $this->info("Creating default post types...");
        (new \PostTypeSeeder())->createDefaultPostTypes();
        $this->advanceBar();

        // Create tags example
        $this->info("Creating example tags...");
        (new \TagSeeder())->run(20, null, true);
        $this->advanceBar();

        // Create a category
        $this->info("Creating an example category...");
        $categoryObj = new \CategorySeeder();
        $categoryObj->exampleTitles = true;
        $categoryObj->run(3, null);
        $this->advanceBar();

        $this->info("Creating example posts...");
        (new \PostSeeder())->run(0, 5, '', 0, 0, 0, false);
        $this->advanceBar();

        // Create default permalinks
        $this->info("Creating default permalinks...");
        (new \PermalinksTableSeeder())->run();
        $this->advanceBar();

        // Creating settings
        $this->info("Saving settings...");
        $this->setSettings();
        $this->advanceBar();

        // Create Primary Menu
        $this->info("Creating primary Menu...");
        $menuSeeder = new \MenuSeeder();
        $menu = $menuSeeder->createPrimaryMenu();
        $menuSeeder->addHomepageToPrimaryMenu($menu);
        $menuSeeder->addAboutToPrimaryMenu($menu);
        $menuSeeder->addCategoryToMenu($menu);
        $this->advanceBar();

        return $this;
    }
478830
public function add_new_item($title='') {
        $nitem = new cc_item();
        $nitem->title = $title;
        $this->add_item($nitem);
        return $nitem;
    }
438003
public static function buildEvent($text, $title = '', array $options = array()) {
        $event = new Event($text, $title);

        foreach ($options as $property => $value) {
            self::setProperty($event, $property, $value);
        }

        return $event;
    }
879287
public function keyword($title, $content, $options=array()){

        $data = array();
        
        $data['title'] = $title;
        $data['content'] = $content;

        $data = array_merge($data, $options);
        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');

        return $this->request($this->keywordUrl, $data);
    }
879763
public function addGroupTextareaAction($title)
	{
		$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;

		return $this->group_actions[$id] = new GroupTextareaAction($title);
	}
357035
public static function a($href, $content = '', $title = '', $target = '', $options = [])
    {
        $a_tag_tpl = '<a href="%s" title="%s" target="%s"%s>%s</a>';
        return sprintf($a_tag_tpl, $href, $title, $target, self::assembleTagOptions($options), $content);
    }
863766
public function iShouldSeeAsAnExcerptOfBlogPost($title, $excerpt)
    {
        $excerpt = str_replace('\\"', '"', $excerpt);
        $xpath = sprintf('//h2[contains(., "%s")]/following-sibling::p', $title);
        $node = $this->getSession()->getPage()->find('xpath', $xpath);

        if (is_null($node)) {
            throw new ElementNotFoundException($this->getSession(), 'Post excerpt');
        }

        if (false === strpos($node->getHtml(), $excerpt)) {
            throw new ExpectationException(sprintf('Found excerpt: "%s" but expected: "%s"', $node->getHtml(), $excerpt), $this->getSession());
        }
    }