Airship\Cabin\Bridge\Landing\PageManager::deletePage PHP Method

deletePage() public method

public deletePage ( string $cabin = '' )
$cabin string
    public function deletePage(string $cabin = '')
    {
        $page = [];
        $path = $this->determinePath($cabin);
        if (!\is1DArray($_GET)) {
            \Airship\redirect($this->airship_cabin_prefix . '/pages/' . \trim($cabin, '/'));
        }
        $cabins = $this->getCabinNamespaces();
        if (!\in_array($cabin, $cabins)) {
            \Airship\redirect($this->airship_cabin_prefix);
        }
        $this->setTemplateExtraData($cabin);
        if (!$this->can('delete')) {
            \Airship\redirect($this->airship_cabin_prefix);
        }
        try {
            $page = $this->pg->getPageInfo($cabin, $path, (string) ($_GET['page'] ?? ''));
        } catch (CustomPageNotFoundException $ex) {
            \Airship\redirect($this->airship_cabin_prefix . '/pages/' . \trim($cabin, '/'));
        }
        $secretKey = $this->config('recaptcha.secret-key');
        if (empty($secretKey)) {
            $this->lens('pages/bad_config');
        }
        $post = $this->post(new DeletePageFilter());
        if (!empty($post)) {
            if (isset($post['g-recaptcha-response'])) {
                $rc = \Airship\getReCaptcha($secretKey, $this->config('recaptcha.curl-opts') ?? []);
                $resp = $rc->verify($post['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
                if ($resp->isSuccess()) {
                    // CAPTCHA verification and CSRF token both passed
                    $this->processDeletePage((int) $page['pageid'], $post, $cabin, $path);
                }
            }
        }
        $this->lens('pages/page_delete', ['cabins' => $cabins, 'pageinfo' => $page, 'config' => $this->config(), 'dir' => $path, 'cabin' => $cabin, 'pathinfo' => \Airship\chunk($path)]);
    }