');
// Traitement des modifications de la configuration
if (isset($_POST['submit']))
{
$my_config = array();
// Activation de la pagination
$my_config['dc_pagination_active'] = !(empty($_POST['active']));
// Modes à intercepter
$intercepted_modes = array();
foreach (array('home','cat','year','month','day','search') as $key) {
if (!empty($_POST[$key])) {
$intercepted_modes[$key] = true;
}
}
$my_config['dc_pagination_modes'] = implode(';',array_keys($intercepted_modes));
// Options avancées (0.1.4+)
// Nombre de billets par page
$pg_pagesize = (integer)$_POST['posts_per_page'];
if ($pg_pagesize <= 0) {
$pg_pagesize = dc_nb_post_per_page;
}
$my_config['dc_pagination_pagesize'] = $pg_pagesize;
// Nombre de pages par groupe
$pg_groupsize = (integer)$_POST['pages_per_group'];
if ($pg_groupsize <= 0) {
$pg_groupsize = 5;
}
$my_config['dc_pagination_groupsize'] = $pg_groupsize;
// Activation du mode étendu
$my_config['dc_pagination_external'] = isset($_POST['external']);
// Ecriture de la nouvelle configuration
if (installer::savePluginConfig($my_name,$my_config)) {
$res = __('New configuration saved.');
} else {
$res = __('Unable to save configuration');
}
}
// Vérification de l'installation et récupération de la configuration
else
{
if (($err = installer::checkPluginShareDir($my_name))) {
buffer::str(
'
'.
sprintf(__('Unavailable %s/ directory in share/. You may create it manually.'),$my_name).
'
'.
'
'
);
}
$my_config = installer::loadPluginConfig($my_name);
if (!$my_config) {
$my_config = array('dc_pagination_active' => 0, 'dc_pagination_modes' => '');
}
$intercepted_modes = array();
if ($my_config['dc_pagination_modes'] != '') {
foreach (explode(';',$my_config['dc_pagination_modes']) as $key) {
$intercepted_modes[$key] = true;
}
}
}
// Affichage d'un message d'erreur ou d'état si défini.
if (!empty($res)) {
buffer::str('
'.$res.'
');
}
// Affichage du formulaire de modification des paramètres de configuration
buffer::str(
'
'.__('Configuration').'
'.
''
);
// Notes rapides pour une utilisation basique
/*
buffer::str(
'
'.__('Usage').'
'.
'
'.__('Recommended method').'
'.
'
'.__('First, in the template.php of your theme, add the following line at the very top of the file').' :
'.
'
'.
'<?php if (!empty($is_paginated)) dcPagination::restoreMode(); ?>'.
'
'.
'
'.__('Then, in the list.php file of your theme, add the following line before and/or after the while loop').' :
'.
'
'.
'<?php if (!empty($is_paginated)) dcPagination::showNavigation(); ?>'.
'
'.
'
'.__('Backward compatible method').'
'.
'
'.__('In the list.php file of your theme, add the following line before and/or after the while loop').' :
'.
'
'.
'<?php if ($mode == \'pagination\') dcPagination::showNavigation(); ?>'.
'
'.
'
'.__('Advanced usage').'
'.
'
'.__('For a more advanced usage or more options, please check help.').' '.helpLink('guide&plugin='.$my_name,'')
);
*/
?>