Do the actual registration with WordPress.

@since 0.1.0

@param string     $cpt            Slug of the custom content.
@param Collection $argsCollection Collection of arguments.
505744
protected function doRegistration( $cpt, Collection $argsCollection ) {
		/** @var ArgumentCollection $argsCollection */
		register_post_type( $cpt, $argsCollection->toArray() );
		$this->registerMessages( $cpt, $argsCollection );
	}
224442
private function userHasRequestedARegistrationOnCollection(\collection $collection, $userData)
    {
        if (null === $userRegistration = igorw\get_in($userData, [$collection->get_sbas_id(), $collection->get_base_id()])) {
            return false;
        }

        return !is_null($userRegistration['active']);
    }
955779
protected function set_pagination_args(array $args)
    {
        $args = wp_parse_args($args, array(
            'total_items' => 0,
            'total_pages' => 0,
            'per_page'    => 0
        ));

        if (!$args['total_pages'] && $args['per_page'] > 0) {
            $args['total_pages'] = ceil($args['total_items'] / $args['per_page']);
        }

        // Redirect if page number is invalid and headers are not already sent
        if (!headers_sent() && (!defined('DOING_AJAX') || !DOING_AJAX) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages']) {
            wp_redirect(add_query_arg('paged', $args['total_pages']));
            exit;
        }

        $this->pagination_args = $args;
    }
480802
public function postLoad(LifecycleEventArgs $args)
    {
        $document = $args->getDocument();

        // Sometimes $document is a doctrine proxy class, we therefore need to retrieve it's real class
        $name = $args->getDocumentManager()->getClassMetadata(get_class($document))->getName();

        if (!isset($this->mappings[$name])) {
            return;
        }

        $metadata = $this->mappings[$name];

        if (isset($metadata['fallback_locale'])) {
            $setter = 'set' . ucfirst($metadata['fallback_locale']);
            $document->$setter($this->fallbackLocale);
        }
        if (isset($metadata['current_locale'])) {
            $setter = 'set' . ucfirst($metadata['current_locale']);
            $document->$setter($this->currentLocale);
        }
    }
1127889
public function create($args)
    {
        $meta_args = [];
        $tax_args  = [];

        /*
         * Array of taxonomy terms keyed by their taxonomy name, which WP-CLI can't handle.
         *
         * Values may be delimited by a comma.
         *
         * See https://github.com/wp-cli/entity-command/issues/44#issuecomment-325957179
         */
        if (isset($args['tax_input'])) {
            $tax_args = $args['tax_input'];
            unset($args['tax_input']);
        }

        /*
         * Array of post meta values keyed by their post meta key, which WP-CLI can't handle.
         *
         * See https://github.com/wp-cli/entity-command/issues/44#issuecomment-325957179
         */
        if (isset($args['meta_input'])) {
            $meta_args = $args['meta_input'];
            unset($args['meta_input']);
        }

        $wpcli_args = buildCLIArgs(
            array(
                'ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title',
                'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name',
                'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type',
                'guid', 'post_category', 'page_template',
            ),
            $args
        );

        array_unshift($wpcli_args, '--porcelain');
        $post_id = (int) $this->drivers->getDriver()->wpcli('post', 'create', $wpcli_args)['stdout'];

        // Apply taxonomy values.
        if ($tax_args) {
            foreach ($tax_args as $taxonomy => $terms) {
                $split_terms = str_getcsv($terms);

                foreach ($split_terms as $split_term) {
                    $args = [
                        $post_id,
                        $taxonomy,
                        escapeshellarg($split_term),
                    ];

                    $this->drivers->getDriver()->wpcli('post', 'term add', $args);
                }
            }
        }

        // Apply post meta values.
        if ($meta_args) {
            foreach ($meta_args as $meta_key => $meta_value) {
                $args = [
                    $post_id,
                    $meta_key,
                    escapeshellarg($meta_value),
                ];

                $this->drivers->getDriver()->wpcli('post', 'meta update', $args)['stdout'];
            }
        }

        return $this->get($post_id);
    }
148649
public function addCollection(Collection $collection)
    {
        $metadata = $collection->getDocumentMetadata();
        $this->collectionMapping[$metadata->getName()] = $collection;
    }
89421
private static function register_extensions( $taxonomy, $args ) {
		if ( isset( $args['name_singular'] ) ) {
			( new Taxonomy_Labels( $taxonomy, $args['name_singular'], $args['name_plural'] ) )->init();
		}
	}
875352
protected function configureRoutes(RouteCollection $collection)
    {
        parent::configureRoutes($collection);

        $collection->add('moveUp', $this->getRouterIdParameter() . '/move-up');
        $collection->add('moveDown', $this->getRouterIdParameter() . '/move-down');
    }
601070
protected function registerCollections(array $collections)
    {
        $debugger = $this->app->make(Debugger::class);

        foreach ($collections as $collection) {
            $debugger->populateWith($this->app->make($collection));
        }
    }
934962
private function registerTaxonomy($tax, $cpt_singular, $cpt_plural)
    {
        $singular_name = $this->getSingularTaxName($tax);
        $plural_name = $this->getPluralTaxName($tax);
        $hierarchical = isset($tax['hierarchical']) ? $tax['hierarchical'] : true;
        $default_terms = isset($tax['default_terms']) ? $tax['default_terms'] : [];
        $builder = new Cpt;

        /* Set up the arguments for the priority taxonomy. */
        $args = [
            'public'            => true,
            'show_ui'           => true,
            'show_in_nav_menus' => true,
            'show_admin_column' => true,
            'hierarchical'      => $hierarchical,
            'query_var'         => $singular_name,
            'capabilities' => $this->getCapabilities($cpt_singular, $cpt_plural),
            'labels' => $this->getLabels($tax)
        ];

        // Register the taxonomy
        register_taxonomy($singular_name, [$cpt_singular], $args);

        // add default terms
        $this->taxonomyAddDefaultTerms($singular_name, $default_terms);
    }
1283861
public function registerCollection(array $collection)
    {
        foreach ($collection as $name => $handler) {
            $this->register($name, $handler);
        }

        return $this;
    }
697300
public function registerFieldErrorTemplate(string $field, string $ruleSlug, string $template)
    {
        if (!isset($this->fieldTemplates[$field])) {
            $this->fieldTemplates[$field] = [];
        }

        $this->fieldTemplates[$field][$ruleSlug] = $template;
    }
764348
public function add($view, RuleCollection $collection)
    {
        $name = FormHelper::getFormName($view);
        if (isset($this->rules[$name])) {
            $this->rules[$name]->addCollection($collection);
        } else {
            $this->rules[$name] = $collection;
        }
    }
423319
public function addCollectionAlias($c)
    {
        $db = Database::connection();
        // the passed collection is the parent collection
        $cParentID = $c->getCollectionID();

        $u = new User();
        $uID = $u->getUserID();

        $handle = $this->getCollectionHandle();
        $cDisplayOrder = $c->getNextSubPageDisplayOrder();

        $_cParentID = $c->getCollectionID();
        $q = 'select PagePaths.cPath from PagePaths where cID = ?';
        $v = array($_cParentID);
        if ($_cParentID > 1) {
            $q .=  ' and ppIsCanonical = ?';
            $v[] = 1;
        }
        $cPath = $db->fetchColumn($q, $v);

        $data = array(
            'handle' => $this->getCollectionHandle(),
            'name' => $this->getCollectionName(),
        );
        $cobj = parent::addCollection($data);
        $newCID = $cobj->getCollectionID();

        $v = array($newCID, $cParentID, $uID, $this->getCollectionID(), $cDisplayOrder);
        $q = "insert into Pages (cID, cParentID, uID, cPointerID, cDisplayOrder) values (?, ?, ?, ?, ?)";
        $r = $db->prepare($q);

        $r->execute($v);

        PageStatistics::incrementParents($newCID);

        $q2 = 'insert into PagePaths (cID, cPath, ppIsCanonical, ppGeneratedFromURLSlugs) values (?, ?, ?, ?)';
        $v2 = array($newCID, $cPath.'/'.$handle, 1, 1);
        $db->executeQuery($q2, $v2);

        return $newCID;
    }
1341498
public function run(callable $callback, array $argsCollection)
    {
        $this->collector->init();
        $children = [];
        foreach ($argsCollection as $key => $args) {
            $pid = pcntl_fork();
            switch ($pid) {
                case -1:
                    throw new \RuntimeException(sprintf('Unable to fork process %d of %d', $key,
                        count($argsCollection)));
                case 0: // child
                    $this->collector->setValue($key, call_user_func_array($callback, $args));
                    exit(0);
                default: //parent
                    $children[] = $pid;
            }
        }
        foreach ($children as $child) {
            do {
                pcntl_waitpid($child, $status);
            } while (!pcntl_wifexited($status));
        }
        return $this->collector->getValues(array_keys($argsCollection));
    }
557077
public static function add(&$set, $args)
    {
        self::assertArgsNumber(1, $args);

        $value = $args[0];

        foreach ($set as $item) {
            if ($item === $value) {
                return;
            }
        }

        $set[] = $value;
    }
347617
public function registerCampaign($collection, $websiteId)
    {
        //review campaign id
        $campaignId = $this->helper->getCampaign($websiteId);

        if ($campaignId) {
            foreach ($collection as $order) {
                $this->helper->log(
                    '-- Order Review: ' . $order->getIncrementId()
                    . ' Campaign Id: ' . $campaignId
                );

                try {
                    $emailCampaign = $this->campaignFactory->create()
                        ->setEmail($order->getCustomerEmail())
                        ->setStoreId($order->getStoreId())
                        ->setCampaignId($campaignId)
                        ->setEventName('Order Review')
                        ->setCreatedAt($this->dateTime->formatDate(true))
                        ->setOrderIncrementId($order->getIncrementId())
                        ->setQuoteId($order->getQuoteId());

                    if ($order->getCustomerId()) {
                        $emailCampaign->setCustomerId($order->getCustomerId());
                    }
                    $this->campaignResource->saveItem($emailCampaign);
                } catch (\Exception $e) {
                    $this->helper->debug((string)$e, []);
                }
            }
        }
    }