From 0ae0ca03d1b3407686e94df92f18395c84c9862a Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 12 Sep 2021 21:15:07 +0200 Subject: [PATCH] update _ config code --- _config.php | 137 ++++++++++++++++++++++------------------------------ 1 file changed, 59 insertions(+), 78 deletions(-) diff --git a/_config.php b/_config.php index a696d2e..90b227d 100644 --- a/_config.php +++ b/_config.php @@ -12,12 +12,10 @@ */ if (!defined('DC_CONTEXT_MODULE')) { - return null; } -$redir = empty($_REQUEST['redir']) ? - $list->getURL().'#plugins' : $_REQUEST['redir']; +$redir = empty($_REQUEST['redir']) ? $list->getURL() . '#plugins' : $_REQUEST['redir']; # -- Get settings -- $core->blog->settings->addNamespace('zoneclearFeedServer'); @@ -38,17 +36,16 @@ if ($update_limit < 1) { $update_limit = 10; } if (!is_array($post_full_tpl)) { - $post_full_tpl = array(); + $post_full_tpl = []; } if (!is_array($post_title_redir)) { - $post_title_redir = array(); + $post_title_redir = []; } $zc = new zoneclearFeedServer($core); # -- Set settings -- if (!empty($_POST['save'])) { - try { $active = !empty($_POST['active']); $pub_active = !empty($_POST['pub_active']); @@ -81,135 +78,119 @@ if (!empty($_POST['save'])) { dcPage::addSuccessNotice( __('Configuration successfully updated.') ); - http::redirect( - $list->getURL('module=zoneclearFeedServer&conf=1&redir='. - $list->getRedir()) + $core->adminurl->redirect( + 'admin.plugins', + ['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => $list->getRedir()] ); - } - catch (Exception $e) { + } catch (Exception $e) { $core->error->add($e->getMessage()); } } # -- Form combos -- $combo_admins = $zc->getAllBlogAdmins(); -$combo_pubupd = array( - __('Disable') => 0, +$combo_pubupd = [ + __('Disable') => 0, __('Before display') => 1, - __('After display') => 2, - __('Through Ajax') => 3 -); -$combo_status = array( + __('After display') => 2, + __('Through Ajax') => 3 +]; +$combo_status = [ __('Unpublished') => 0, - __('Published') => 1 -); -$combo_tagcase = array( + __('Published') => 1 +]; +$combo_tagcase = [ __('Keep source case') => 0, __('First upper case') => 1, - __('All lower case') => 2, - __('All upper case') => 3 -); + __('All lower case') => 2, + __('All upper case') => 3 +]; $pub_page_url = $core->blog->url.$core->url->getBase('zoneclearFeedsPage'); # -- Display form -- if (!is_writable(DC_TPL_CACHE)) { - echo - '

'. - __('Dotclear cache is not writable or not well configured!'). - '

'; + echo '

'. __('Dotclear cache is not writable or not well configured!') . '

'; } echo ' -
-

'.__('Activation').'

+

' . __('Activation') . '

-

-
'; +

+ -echo '
'; if ($core->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) { - echo '

'.__('View the public list of feeds').'

'; + echo sprintf( + '

%s

', + $pub_page_url, + $pub_page_url, + __('View the public list of feeds') + ); } echo ' -

'.__('Rules').'

+

' . __('Rules') . '

-

'. -form::combo('post_status_new', $combo_status, $post_status_new).'

+

' . +form::combo('post_status_new', $combo_status, $post_status_new) . '

'. -form::combo('feeduser', $combo_admins, $feeduser).'

+__('Owner of entries created by zoneclearFeedServer:') . '' . +form::combo('feeduser', $combo_admins, $feeduser) . '

-

'. -form::combo('tag_case', $combo_tagcase, $tag_case).'

+

' . +form::combo('tag_case', $combo_tagcase, $tag_case) . '

-

'. -form::combo('bhv_pub_upd', $combo_pubupd, $bhv_pub_upd).'

+

' . +form::combo('bhv_pub_upd', $combo_pubupd, $bhv_pub_upd) . '

-

'. -form::field('update_limit', 6, 4, $update_limit).'

+

' . +form::field('update_limit', 6, 4, $update_limit) . '

-

+

-

+

-

'.__('Redirect to original post on:').'

    '; +

    ' . __('Redirect to original post on:') . '

      '; foreach($zc->getPublicUrlTypes($core) as $k => $v) { - echo - '
    • ', $v, - in_array($v, $post_title_redir) - ). - __($k).''; + form::checkbox(['post_title_redir[]', 'post_title_redir_' . $v], $v, in_array($v, $post_title_redir)), + __($k) + ); } echo '
-

'.__('Show full content on:').'

    '; +

    ' . __('Show full content on:') . '

      '; foreach($zc->getPublicUrlTypes($core) as $k => $v) { - echo - '
    • ', $v, - in_array($v, $post_full_tpl) - ). - __($k).''; + form::checkbox(['post_full_tpl[]', 'post_full_tpl_' . $v], $v, in_array($v, $post_full_tpl)), + __($k) + ); } -echo ' -
    -
- -
-'; +echo ''; dcPage::helpBlock('zoneclearFeedServer'); \ No newline at end of file