Add auto-export feature: Enable automatic pushing of articles to GitHub on save, with configuration options in the plugin settings.

This commit is contained in:
interlope committed 2026-06-08 18:22:26 +02:00
1 parent 1f440494b3
commit b08116fba1
2 files changed
+15 -5

No files matched your search

+11 -3
View File
@@ -11,6 +11,7 @@ class pluginBluditGithub extends Plugin
'branch' => 'main',
'path' => '',
'exportDrafts' => false,
'autoExport' => true,
];
}
@@ -52,7 +53,14 @@ class pluginBluditGithub extends Plugin
$html .= '</div>';
$html .= '<div>';
$html .= '<label><input name="exportDrafts" type="checkbox" value="1" ' . $exportDrafts . '> Export draft articles</label>';
$html .= '<label><input name="exportDrafts" type="hidden" value="0">';
$html .= '<input name="exportDrafts" type="checkbox" value="1" ' . $exportDrafts . '> Export draft articles</label>';
$html .= '</div>';
$autoExport = $this->getValue('autoExport') ? 'checked' : '';
$html .= '<div>';
$html .= '<label><input name="autoExport" type="hidden" value="0">';
$html .= '<input name="autoExport" type="checkbox" value="1" ' . $autoExport . '> Auto-export on save <em>(uncheck to only use manual bulk export)</em></label>';
$html .= '</div>';
$html .= '<div style="margin-top:1.5em;padding-top:1em;border-top:1px solid #eee">';
@@ -82,7 +90,7 @@ class pluginBluditGithub extends Plugin
public function afterPageCreate($key)
{
try {
if (empty($key) || !$this->isConfigured()) {
if (empty($key) || !$this->isConfigured() || !$this->getValue('autoExport')) {
return;
}
$page = new Page($key);
@@ -97,7 +105,7 @@ class pluginBluditGithub extends Plugin
public function afterPageModify($key)
{
try {
if (empty($key) || !$this->isConfigured()) {
if (empty($key) || !$this->isConfigured() || !$this->getValue('autoExport')) {
return;
}
$page = new Page($key);