improve = new improve(); $this->saveConfig(); $this->displayConfig(); } private function getModules(): array { $modules = []; foreach ($this->improve->modules() as $action) { $modules[$action->name()] = $action->id(); } $modules = array_merge($modules, array_flip($this->improve->disabled())); return $modules; } private function saveConfig(): void { if (empty($_POST['save'])) { return; } try { $pdisabled = ''; if (!empty($_POST['disabled']) && is_array($_POST['disabled'])) { $pdisabled = implode(';', $_POST['disabled']); } dcCore::app()->blog->settings->improve->put('disabled', $pdisabled); dcCore::app()->blog->settings->improve->put('nodetails', !empty($_POST['nodetails'])); dcPage::addSuccessNotice(__('Configuration successfully updated')); dcCore::app()->adminurl->redirect( 'admin.plugins', ['module' => 'improve', 'conf' => 1, 'chk' => 1, 'redir' => dcCore::app()->admin->__get('list')->getRedir()] ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } private function displayConfig(): void { echo '

' . __('List of disabled actions:') . '

'; foreach ($this->getModules() as $name => $id) { echo '

'; } echo '

' . __('Options') . '

' . '

' . '
'; } } /* process */ new config();