diff --git a/_admin.php b/_admin.php index 54415b4..b1a6773 100644 --- a/_admin.php +++ b/_admin.php @@ -28,6 +28,8 @@ if ($core->blog->settings->postwidgettext->postwidgettext_active) { ); $core->addBehavior('adminDashboardFavorites', ['postWidgetTextDashboard', 'favorites']); + $core->addBehavior('adminBlogPreferencesForm', ['postWidgetTextAdmin', 'adminBlogPreferencesForm']); + $core->addBehavior('adminBeforeBlogSettingsUpdate', ['postWidgetTextAdmin', 'adminBeforeBlogSettingsUpdate']); } # Pref $core->addBehavior('adminFiltersLists', ['postWidgetTextAdmin', 'adminFiltersLists']); diff --git a/_config.php b/_config.php deleted file mode 100644 index 526a6e8..0000000 --- a/_config.php +++ /dev/null @@ -1,68 +0,0 @@ -getURL().'#plugins' : $_REQUEST['redir']; - -# -- Get settings -- -$core->blog->settings->addNamespace('postwidgettext'); -$s = $core->blog->settings->postwidgettext; - -$active = (boolean) $s->postwidgettext_active; -$importexport_active = (boolean) $s->postwidgettext_importexport_active; - -# -- Set settings -- -if (!empty($_POST['save'])) { - - try { - $active = !empty($_POST['active']); - $importexport_active = !empty($_POST['importexport_active']); - - $s->put('postwidgettext_active', $active); - $s->put('postwidgettext_importexport_active', $importexport_active); - - $core->blog->triggerBlog(); - - dcPage::addSuccessNotice( - __('Configuration successfully updated') - ); - http::redirect( - $list->getURL('module=postWidgetText&conf=1&redir='. - $list->getRedir()) - ); - } - catch (Exception $e) { - $core->error->add($e->getMessage()); - } -} - -# -- Display form -- -echo ' - -
-

'.__('Activation').'

- -

- -

- -
'; \ No newline at end of file diff --git a/_define.php b/_define.php index 8d0e559..8b7702c 100644 --- a/_define.php +++ b/_define.php @@ -26,6 +26,9 @@ $this->registerModule( 'type' => 'plugin', 'support' => 'https://github.com/JcDenis/postWidgetText', 'details' => 'https://plugins.dotaddict.org/dc2/details/postWidgetText', - 'repository' => 'https://raw.githubusercontent.com/JcDenis/postWidgetText/master/dcstore.xml' + 'repository' => 'https://raw.githubusercontent.com/JcDenis/postWidgetText/master/dcstore.xml', + 'settings' => [ + 'blog' => '#params.pwt_params' + ] ] ); \ No newline at end of file diff --git a/inc/lib.pwt.admin.php b/inc/lib.pwt.admin.php index 3004939..eadfdd6 100644 --- a/inc/lib.pwt.admin.php +++ b/inc/lib.pwt.admin.php @@ -43,6 +43,34 @@ class postWidgetTextAdmin ]; } + public static function adminBlogPreferencesForm(dcCore $core, dcSettings $blog_settings) + { + echo ' +
+

' . __('Post widget text') . '

+
+
+

+
+
+

+
+
+
+
'; + } + + public static function adminBeforeBlogSettingsUpdate(dcSettings $blog_settings) + { + $blog_settings->postwidgettext->put('postwidgettext_active', !empty($_POST['active'])); + $blog_settings->postwidgettext->put('postwidgettext_importexport_active', !empty($_POST['importexport_active'])); + + } + public static function headers() { return dcPage::jsLoad(dcPage::getPF('postWidgetText/js/post.js'));