diff --git a/bl-plugins/remote-content/languages/da.json b/bl-plugins/remote-content/languages/da.json deleted file mode 100644 index bcc46de7..00000000 --- a/bl-plugins/remote-content/languages/da.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "complete-url-of-the-zip-file": "Den komplette URL sti, til der hvor zip filen befinder sig.", - "plugin-data": { - "description": "Denne udvidelse giver en nem måde at få indholdet fra dit websted uploadet til Github eller lignende service, og være fuld synkroniseret med din Koblog installation.", - "name": "Remote Content" - }, - "source": "Kilde", - "try-webhook": "Prøv webhook'et", - "webhook": "Webhook" -} diff --git a/bl-plugins/remote-content/languages/de_CH.json b/bl-plugins/remote-content/languages/de_CH.json deleted file mode 100644 index 0f59e398..00000000 --- a/bl-plugins/remote-content/languages/de_CH.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "plugin-data": - { - "name": "Remote Content", - "description": "Das Plugin snychronisiert die Inhalte eines Repository wie GitHub mit einer Koblog-Installation." - }, - "webhook": "Webhook", - "source": "Quelle", - "try-webhook": "Webhook testen", - "complete-url-of-the-zip-file": "Vollständiger URL des ZIP-Archivs."} diff --git a/bl-plugins/remote-content/languages/de_DE.json b/bl-plugins/remote-content/languages/de_DE.json deleted file mode 100644 index 0f59e398..00000000 --- a/bl-plugins/remote-content/languages/de_DE.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "plugin-data": - { - "name": "Remote Content", - "description": "Das Plugin snychronisiert die Inhalte eines Repository wie GitHub mit einer Koblog-Installation." - }, - "webhook": "Webhook", - "source": "Quelle", - "try-webhook": "Webhook testen", - "complete-url-of-the-zip-file": "Vollständiger URL des ZIP-Archivs."} diff --git a/bl-plugins/remote-content/languages/en.json b/bl-plugins/remote-content/languages/en.json deleted file mode 100644 index 010873a2..00000000 --- a/bl-plugins/remote-content/languages/en.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Remote Content", - "description": "This plugin provides an easy way to have the content of your site on Github or similar and in turn is synchronized with your Koblog." - }, - "webhook": "Webhook", - "source": "Source", - "try-webhook": "Try webhook", - "complete-url-of-the-zip-file": "Complete URL of the zip file." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/es.json b/bl-plugins/remote-content/languages/es.json deleted file mode 100644 index 4510aba1..00000000 --- a/bl-plugins/remote-content/languages/es.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Contenido remoto", - "description": "Este plugin provee una forma facil de tener el contenido de tu sitio en Github o similar y a su vez esta sincronizado con tu Koblog." - }, - "webhook": "Webhook", - "source": "Origen", - "try-webhook": "Probar webhook", - "complete-url-of-the-zip-file": "URL completa del archivo zip." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/fa_IR.json b/bl-plugins/remote-content/languages/fa_IR.json deleted file mode 100644 index 4f81737e..00000000 --- a/bl-plugins/remote-content/languages/fa_IR.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "محتوای راه دور", - "description": "این افزونه یک راه آسان برای داشتن محتوای سایت شما در Github یا مشابه دارد و به نوبه خود، با بلودیت شما هماهنگ شده است ." - }, - "webhook": "Webhook", - "source": "منبع", - "try-webhook": "امتحان webhook", - "complete-url-of-the-zip-file": "آدرس وب کامل فایل زیپ." -} diff --git a/bl-plugins/remote-content/languages/fr_FR.json b/bl-plugins/remote-content/languages/fr_FR.json deleted file mode 100644 index 89f3e1d2..00000000 --- a/bl-plugins/remote-content/languages/fr_FR.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Contenu distant", - "description": "Ce plugin fournit un moyen facile d'avoir le contenu de votre site sur Github ou similaire et à son tour est synchronisé avec votre Koblog." - }, - "webhook": "Webhook", - "source": "Source", - "try-webhook": "Tester le webhook", - "complete-url-of-the-zip-file": "URL complète du fichier zip." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/it.json b/bl-plugins/remote-content/languages/it.json deleted file mode 100644 index 7f31802d..00000000 --- a/bl-plugins/remote-content/languages/it.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Contenuto remoto", - "description": "Questo plugin offre un modo semplice di avere il contenuto del proprio sito su Github e simili e di tenerli sincronizzati con Koblog." - }, - "webhook": "Webhook", - "source": "Sorgente", - "try-webhook": "Prova webhook", - "complete-url-of-the-zip-file": "URL completo del file zipe." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/ja_JP.json b/bl-plugins/remote-content/languages/ja_JP.json deleted file mode 100644 index aa629aee..00000000 --- a/bl-plugins/remote-content/languages/ja_JP.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Remote Content", - "description": "This plugin provides an easy way to have the content of your site on Github or similar and in turn is synchronized with your Koblog." - }, - "webhook": "Webhook", - "source": "ソース", - "try-webhook": "Try webhook", - "complete-url-of-the-zip-file": "Complete URL of the zip file." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/nl_NL.json b/bl-plugins/remote-content/languages/nl_NL.json deleted file mode 100644 index 8c0b43c4..00000000 --- a/bl-plugins/remote-content/languages/nl_NL.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Externe Inhoud", - "description": "Met deze plugin is het eenvoudig om inhoud voor de website op GitHub of soortgelijke bronnen te beheren en vervolgens te synchroniseren met Koblog." - }, - "webhook": "Web-hook", - "source": "Bron", - "try-webhook": "Web-hook testen", - "complete-url-of-the-zip-file": "Complete URL van het .zip-bestand." -} \ No newline at end of file diff --git a/bl-plugins/remote-content/languages/ru_RU.json b/bl-plugins/remote-content/languages/ru_RU.json deleted file mode 100644 index 65b37c1e..00000000 --- a/bl-plugins/remote-content/languages/ru_RU.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "plugin-data": - { - "name": "Remote Content", - "description": "Этот плагин обеспечивает простой способ синхронизации вашего сайта и Github или аналогичной платформы." - }, - "webhook": "Вебхук", - "source": "Источник", - "try-webhook": "Попробовать этот вебхук", - "complete-url-of-the-zip-file": "Полный URL-адрес zip-файла." -} diff --git a/bl-plugins/remote-content/metadata.json b/bl-plugins/remote-content/metadata.json deleted file mode 100644 index 58b5cad8..00000000 --- a/bl-plugins/remote-content/metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "author": "Koblog", - "email": "", - "website": "https://plugins.koblog.com/plugin/remote-content", - "version": "kb_0.0.1", - "releaseDate": "2024-08-23", - "license": "MIT", - "compatible": "kb_0.0.1", - "notes": "" -} diff --git a/bl-plugins/remote-content/plugin.php b/bl-plugins/remote-content/plugin.php deleted file mode 100644 index 30b0d102..00000000 --- a/bl-plugins/remote-content/plugin.php +++ /dev/null @@ -1,208 +0,0 @@ -dbFields = array( - 'webhook' => $randomWebhook, - 'source' => '' - ); - } - - public function form() - { - global $language; - - if (extension_loaded('zip') === false) { - $this->formButtons = false; - return '
' . $language->get('the-extension-zip-is-not-installed') . '
'; - } - - $html = '
'; - $html .= ''; - $html .= ''; - $html .= '' . DOMAIN_BASE . $this->getValue('webhook') . ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= '' . $language->get('Complete URL of the zip file') . ''; - $html .= '
'; - - $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= << - function tryWebhook() { - var webhook = document.getElementById("jswebhook").value; - window.open(DOMAIN_BASE+webhook, '_blank'); - } - -EOF; - $html .= '
'; - - return $html; - } - - public function beforeAll() - { - // Check Webhook - $webhook = $this->getValue('webhook'); - if ($this->webhook($webhook)) { - $this->cleanUp(); - - // Download files - $this->downloadFiles(); - - // Delete the current content - $this->deleteContent(); - - // Generate the new content - $this->generateContent(); - - // End request - $this->response(array('status' => '0')); - } - } - - private function downloadFiles() - { - // Download the zip file - Log::set('Plugin Remote Content' . LOG_SEP . 'Downloading the zip file.'); - $source = $this->getValue('source'); - $destinationPath = $this->workspace(); - $destinationFile = $destinationPath . 'content.zip'; - TCP::download($source, $destinationFile); - - // Uncompress the zip file - Log::set('Plugin Remote Content' . LOG_SEP . 'Uncompress the zip file.'); - $zip = new ZipArchive; - if ($zip->open($destinationFile) === true) { - $zip->extractTo($destinationPath); - $zip->close(); - } - - // Delete the zip file - unlink($destinationFile); - return true; - } - - // Delete the page and uploads directories from bl-content - private function deleteContent() - { - // Clean the page database - global $pages; - $pages->db = array(); - - Filesystem::deleteRecursive(PATH_PAGES); - Filesystem::deleteRecursive(PATH_UPLOADS); - mkdir(PATH_PAGES, DIR_PERMISSIONS, true); - mkdir(PATH_UPLOADS, DIR_PERMISSIONS, true); - mkdir(PATH_UPLOADS_PROFILES, DIR_PERMISSIONS, true); - mkdir(PATH_UPLOADS_THUMBNAILS, DIR_PERMISSIONS, true); - - return true; - } - - private function cleanUp() - { - $workspace = $this->workspace(); - Filesystem::deleteRecursive($workspace . DS); - mkdir($workspace, DIR_PERMISSIONS, true); - return true; - } - - private function generateContent() - { - global $pages; - - $root = Filesystem::listDirectories($this->workspace()); - $root = $root[0]; // first directory created by the unzip - - // For each page inside the pages directory - // Parse the page and add to the database - if (Filesystem::directoryExists($root . DS . 'pages')) { - $parentList = Filesystem::listDirectories($root . DS . 'pages' . DS); - foreach ($parentList as $parentDirectory) { - $parentKey = basename($parentDirectory); - if (Filesystem::fileExists($parentDirectory . DS . 'index.md')) { - $row = $this->parsePage($parentDirectory . DS . 'index.md'); - $row['slug'] = $parentKey; - $pages->add($row); - } - - $childList = Filesystem::listDirectories($parentDirectory . DS); - foreach ($childList as $childDirectory) { - $childKey = basename($childDirectory); - if (Filesystem::fileExists($childDirectory . DS . 'index.md')) { - $row = $this->parsePage($childDirectory . DS . 'index.md'); - $row['slug'] = $childKey; - $row['parent'] = $parentKey; - $pages->add($row); - } - } - } - - Theme::plugins('afterPageCreate'); - reindexCategories(); - reindexTags(); - reindexAuthors(); - reindexArchives(); - reindexKinds(); - } - - return true; - } - - private function response($data = array()) - { - $json = json_encode($data); - header('Content-Type: application/json'); - exit($json); - } - - private function parsePage($filename) - { - $lines = file($filename); - $row = array(); - - // Title - $title = ltrim($lines[0], '#'); // Remove the first # - $title = trim($title); - unset($lines[0]); - $row['title'] = $title; - - foreach ($lines as $key => $line) { - if (Text::startsWith($line, '