diff --git a/plugin.php b/plugin.php index 6303306..ad25e92 100644 --- a/plugin.php +++ b/plugin.php @@ -53,14 +53,12 @@ class pluginBluditGithub extends Plugin $html .= ''; $html .= '
'; - $html .= ''; + $html .= ''; $html .= '
'; $autoExport = $this->getValue('autoExport') ? 'checked' : ''; $html .= '
'; - $html .= ''; + $html .= ''; $html .= '
'; $html .= '
'; @@ -82,6 +80,11 @@ class pluginBluditGithub extends Plugin { parent::post(); + // Ensure checkboxes are properly saved as boolean (Bludit might store them as strings) + $this->db['exportDrafts'] = (isset($_POST['exportDrafts']) && $_POST['exportDrafts']) ? true : false; + $this->db['autoExport'] = (isset($_POST['autoExport']) && $_POST['autoExport']) ? true : false; + $this->dbSave(); + if (!empty($_POST['bulkExport'])) { $this->bulkExport(); } @@ -160,7 +163,11 @@ class pluginBluditGithub extends Plugin private function shouldExport($page) { - return $page->getValue('status') !== 'draft' || $this->getValue('exportDrafts'); + $isDraft = $page->getValue('status') === 'draft'; + $exportDraftsVal = $this->getValue('exportDrafts'); + $shouldExportDraft = ($exportDraftsVal === true || $exportDraftsVal === '1' || $exportDraftsVal === 1); + + return (!$isDraft) || $shouldExportDraft; } private function exportPage($page, $saveStatus = true)