PressBooks\Modules\Import\Epub\Epub201::kneadAndInsert PHP Метод

kneadAndInsert() защищенный Метод

Pummel then insert HTML into our database
protected kneadAndInsert ( string $href, string $post_type, integer $chapter_parent )
$href string
$post_type string
$chapter_parent integer
    protected function kneadAndInsert($href, $post_type, $chapter_parent)
    {
        $html = $this->getZipContent($href, false);
        $matches = array();
        preg_match('/(?:<title[^>]*>)(.+)<\\/title>/isU', $html, $matches);
        $title = !empty($matches[1]) ? wp_strip_all_tags($matches[1]) : '__UNKNOWN__';
        preg_match('/(?:<body[^>]*>)(.*)<\\/body>/isU', $html, $matches);
        $body = $this->tidy(@$matches[1]);
        $body = $this->kneadHtml($body, $post_type, $href);
        $new_post = array('post_title' => $title, 'post_content' => $body, 'post_type' => $post_type, 'post_status' => 'draft');
        if ('chapter' == $post_type) {
            $new_post['post_parent'] = $chapter_parent;
        }
        $pid = wp_insert_post(add_magic_quotes($new_post));
        update_post_meta($pid, 'pb_show_title', 'on');
        update_post_meta($pid, 'pb_export', 'on');
        Book::consolidatePost($pid, get_post($pid));
        // Reorder
    }