From 427b9f259b5863e8561b77a24af227822d365b7a Mon Sep 17 00:00:00 2001 From: Tobias Krais Date: Thu, 14 Mar 2024 08:02:46 +0100 Subject: [PATCH] finalize version 2 --- boot.php | 8 -------- install.php | 17 +++-------------- lang/de_de.lang | 6 +++--- lang/en_gb.lang | 6 +++--- lib/BackendHelper.php | 2 +- lib/Entry.php | 2 +- lib/LangHelper.php | 7 +++++-- lib/{Modules.php => Module.php} | 4 ++-- package.yml | 4 ++-- pages/setup.php | 32 +++++--------------------------- 10 files changed, 25 insertions(+), 63 deletions(-) rename lib/{Modules.php => Module.php} (98%) diff --git a/boot.php b/boot.php index 3fd3367..f82ccff 100644 --- a/boot.php +++ b/boot.php @@ -9,14 +9,6 @@ rex_extension::register('CLANG_DELETED', 'rex_d2u_guestbook_clang_deleted'); } -rex_extension::register('PACKAGES_INCLUDED', static function ($params) { - /** @deprecated starting with version 2, class alias will be removed */ - class_alias(FriendsOfREDAXO\D2UGuestbook\BackendHelper::class, D2U_Guestbook\d2u_guestbook_backend_helper::class); - class_alias(FriendsOfREDAXO\D2UGuestbook\Entry::class, D2U_Guestbook\Entry::class); - class_alias(FriendsOfREDAXO\D2UGuestbook\LangHelper::class, d2u_guestbook_lang_helper::class); - class_alias(FriendsOfREDAXO\D2UGuestbook\Modules::class, D2UGuestbookModules::class); -}); - /** * Deletes language specific configurations and objects. * @param rex_extension_point> $ep Redaxo extension point diff --git a/install.php b/install.php index b14079b..49b9173 100644 --- a/install.php +++ b/install.php @@ -21,20 +21,9 @@ } // Update modules -if (class_exists(TobiasKrais\D2UHelper\ModuleManager::class)) { - $modules = []; - $modules[] = new \TobiasKrais\D2UHelper\Module('60-1', - 'D2U Guestbook - Gästebuch mit Bootstrap 4 Tabs', - 16); - $modules[] = new \TobiasKrais\D2UHelper\Module('60-2', - 'D2U Guestbook - Infobox Bewertung', - 5); - $modules[] = new \TobiasKrais\D2UHelper\Module('60-3', - 'D2U Guestbook - Gästebuch ohne Tabs', - 13); - $d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager($modules, '', 'd2u_guestbook'); - $d2u_module_manager->autoupdate(); -} +include __DIR__ . DIRECTORY_SEPARATOR .'lib'. DIRECTORY_SEPARATOR .'Module.php'; +$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(\FriendsOfREDAXO\D2UGuestbook\Module::getModules(), '', 'd2u_guestbook'); +$d2u_module_manager->autoupdate(); // Update language replacements if (!class_exists(FriendsOfREDAXO\D2UGuestbook\LangHelper::class)) { diff --git a/lang/de_de.lang b/lang/de_de.lang index 9390cbc..6bb14f4 100644 --- a/lang/de_de.lang +++ b/lang/de_de.lang @@ -1,4 +1,4 @@ -d2u_guestbook = D2U Gästebuch +d2u_guestbook = Gästebuch d2u_guestbook_clang = Sprache d2u_guestbook_date = Datum d2u_guestbook_description = Nachricht @@ -11,8 +11,8 @@ d2u_guestbook_rating = Bewertung (1=schlecht / 5=sgt) d2u_guestbook_recommendation = Empfehlung d2u_guestbook_url = Webseite -d2u_guestbook_rights = D2U Gästebuch Addon -d2u_guestbook_rights_settings = D2U Gästebuch Addon: Einstellungen +d2u_guestbook_rights = Gästebuch Addon +d2u_guestbook_rights_settings = Gästebuch Addon: Einstellungen d2u_guestbook_settings_allow_answer = E-Mailadresse von Einträgen geschützt veröffentlichen um Antworten zu erlauben? d2u_guestbook_settings_article = Gästebuch Artikel diff --git a/lang/en_gb.lang b/lang/en_gb.lang index 9eec418..efe25a6 100644 --- a/lang/en_gb.lang +++ b/lang/en_gb.lang @@ -1,4 +1,4 @@ -d2u_guestbook = D2U Guestbook +d2u_guestbook = Guestbook d2u_guestbook_clang = Language d2u_guestbook_date = Date d2u_guestbook_description = Message @@ -11,8 +11,8 @@ d2u_guestbook_rating = Rating (1=bad / 5=best) d2u_guestbook_recommendation = recommendation d2u_guestbook_url = Website -d2u_guestbook_rights = D2U Guestbook Addon -d2u_guestbook_rights_settings = D2U Guestbook Addon: Settings +d2u_guestbook_rights = Guestbook Addon +d2u_guestbook_rights_settings = Guestbook Addon: Settings d2u_guestbook_settings_allow_answer = Do not show email address and thus allow answering to entries d2u_guestbook_settings_article = Guestbook redaxo article diff --git a/lib/BackendHelper.php b/lib/BackendHelper.php index 76bea09..7fc7384 100644 --- a/lib/BackendHelper.php +++ b/lib/BackendHelper.php @@ -52,4 +52,4 @@ public static function sendAdminNotification($yform):void $mail->send(); } } -} +} \ No newline at end of file diff --git a/lib/Entry.php b/lib/Entry.php index a71752d..7db8071 100644 --- a/lib/Entry.php +++ b/lib/Entry.php @@ -190,4 +190,4 @@ public function save() return $error; } -} +} \ No newline at end of file diff --git a/lib/LangHelper.php b/lib/LangHelper.php index 688eda2..42a6913 100644 --- a/lib/LangHelper.php +++ b/lib/LangHelper.php @@ -2,6 +2,9 @@ namespace FriendsOfREDAXO\D2UGuestbook; +use rex_clang; +use rex_config; + /** * @api * Offers helper functions for language issues. @@ -77,7 +80,7 @@ class LangHelper extends \TobiasKrais\D2UHelper\ALangHelper /** * Factory method. - * @return d2u_guestbook_lang_helper Object + * @return self Object */ public static function factory() { @@ -105,4 +108,4 @@ public function install(): void } } } -} +} \ No newline at end of file diff --git a/lib/Modules.php b/lib/Module.php similarity index 98% rename from lib/Modules.php rename to lib/Module.php index 0d90795..ad53629 100644 --- a/lib/Modules.php +++ b/lib/Module.php @@ -7,7 +7,7 @@ * * @author Tobias Krais */ -class Modules +class Module { /** * Get modules offered by this addon. @@ -27,4 +27,4 @@ public static function getModules() 13); return $modules; } -} +} \ No newline at end of file diff --git a/package.yml b/package.yml index 2df8de9..5066dab 100644 --- a/package.yml +++ b/package.yml @@ -1,6 +1,6 @@ package: d2u_guestbook -version: '1.1.0' -author: FriendsOfREDAXO +version: '2.0.0' +author: Friends Of REDAXO supportpage: http://github.com/FriendsOfREDAXO/d2u_guestbook page: diff --git a/pages/setup.php b/pages/setup.php index e865fcc..4595671 100644 --- a/pages/setup.php +++ b/pages/setup.php @@ -2,7 +2,7 @@ /* * Modules */ -$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(D2UGuestbookModules::getModules(), 'modules/', 'd2u_guestbook'); +$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(\FriendsOfREDAXO\D2UGuestbook\Module::getModules(), 'modules/', 'd2u_guestbook'); // \TobiasKrais\D2UHelper\ModuleManager actions $d2u_module_id = rex_request('d2u_module_id', 'string'); @@ -15,29 +15,6 @@ // \TobiasKrais\D2UHelper\ModuleManager show list $d2u_module_manager->showManagerList(); -// Import from TVS Guestbook -$sql = rex_sql::factory(); -$sql->setQuery("SHOW TABLES LIKE '". rex::getTablePrefix() ."771_entries'"); -$tvsgb_available = $sql->getRows() > 0 ? true : false; -if ('tvsgb' === rex_request('import', 'string') && $tvsgb_available) { - $sql->setQuery('UPDATE `'. rex::getTablePrefix() ."771_entries` SET description = REPLACE(description, '\r\n', '
'); - INSERT INTO ". rex::getTablePrefix() .'d2u_guestbook (`name`, `email`, `description`, `clang_id`, `online_status`, `create_date`) - SELECT `create_user`, `email`, `description`, `clang`, `status`, FROM_UNIXTIME(`create_date`) FROM '. rex::getTablePrefix() .'771_entries; - UPDATE `'. rex::getTablePrefix() ."d2u_guestbook` SET `online_status` = 'online' WHERE `online_status` = '1'; - UPDATE `". rex::getTablePrefix() ."d2u_guestbook` SET `online_status` = 'offline' WHERE `online_status` = '0'; - UPDATE `". rex::getTablePrefix() .'d2u_guestbook` SET rating = 0 WHERE rating = NULL; - DROP TABLE `'. rex::getTablePrefix() .'771_entries`;'); - if ($sql->hasError()) { - echo rex_view::error('Fehler beim Import: '. $sql->getError()); - } else { - echo rex_view::success('Daten aus TVS Gästebucherfolgreich importiert und alte Tabelle gelöscht.'); - } -} elseif ($tvsgb_available) { - echo '

Import aus Redaxo 4 TVS Gästebuch

'; - echo '

Es wurde eine TVS Gästebuch Tabelle aus Redaxo 4 in der Datenbank gefunden.' - . 'Sollen die Daten importiert werden und die alte Tabelle gelöscht werden?

'; - echo ''; -} ?>

Installation der Module

Die zu den obigen Modulen gehörenden CSS Vorlagen befinden sich im Addon @@ -57,19 +34,20 @@

Support

Fehlermeldungen bitte im GitHub Repository melden.

Changelog

-

1.1.0:

+

2.0.0:

1.0.12: