Blocks = CSSController::GetBlocks(); // Determine which type of page to display // phpcs:ignore WordPress.Security.NonceVerification.Recommended $view_type = isset($_GET['css-edit']) ? 'edit' : (isset($_GET['css-create']) ? 'create' : 'default'); if ($view_type !== 'default') { if ($view_type === 'edit') { // No need for nonce verification here, as the user is not submitting any data // phpcs:ignore WordPress.Security.NonceVerification.Recommended $css_block_id = sanitize_text_field(wp_unslash($_GET['css-edit'])); $this->CurrentCssBlock = isset($this->Blocks[$css_block_id]) ? $this->Blocks[$css_block_id] : false; if (!$this->CurrentCssBlock) { $this->RenderMainPage(); return; } $this->CurrentCssBlock->id = $css_block_id; } else { $this->IsCreating = true; } add_action("admin_footer", array($this, 'RenderLivePreview')); $this->RenderEditPage(); } else { $this->RenderMainPage(); } } private function RenderEditPage() { $edit_or_create = $this->IsCreating ? __("Create CSS Block", "superb-blocks") : __("Edit CSS Block", "superb-blocks"); ?>