suppression de index.php et du paramètre d'activation

This commit is contained in:
blr21560 2013-11-01 16:38:49 +01:00
parent 9145c1fb8a
commit 426183cdde
5 changed files with 0 additions and 109 deletions

View file

@ -16,5 +16,4 @@ class ConstCategoriesPage {
const VERSION = '0.1';
const NS = 'CategoriesPage';
const PARAM = 'CategoriesPage';
const PLUGIN_IS_ACTIVE = 'categoriespage_active';
}

View file

@ -19,15 +19,7 @@ class publicCategoriesPage {
public static function main() {
require_once 'ConstCategoriesPage.php';
$core = $GLOBALS['core'];
$ns = $core->blog->settings->addNamespace(ConstCategoriesPage::NS);
// If categoriesPage is not active we stop here :
if (!$ns->get(ConstCategoriesPage::PLUGIN_IS_ACTIVE)) {
return;
}
require_once '/_widgets.php';
// Adds news Categories' templates tags :

View file

@ -23,10 +23,6 @@ class widgetsCategoriesPage {
public static function main() {
require_once 'ConstCategoriesPage.php';
$core = $GLOBALS['core'];
$ns = $core->blog->settings->addNamespace(ConstCategoriesPage::NS);
if (!$ns->get(ConstCategoriesPage::PLUGIN_IS_ACTIVE)) {
return;
}
$core->addBehavior('initWidgets', array('widgetsCategoriesPage', 'initWidgets'));
}

View file

@ -1,84 +0,0 @@
<?php
/* -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of Categories Page, a plugin for Dotclear 2.
#
# Copyright (c) 2013 Pierre Van Glabeke, Bernard Le Roux
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------*/
if (!defined('DC_CONTEXT_ADMIN')) {
exit;
}
indexCategoriesPage::main();
class indexCategoriesPage {
public static function main() {
require_once 'ConstCategoriesPage.php';
$core = $GLOBALS['core'];
$ns = $core->blog->settings->addNameSpace( ConstCategoriesPage::NS);
if ( $ns->get(ConstCategoriesPage::PLUGIN_IS_ACTIVE) === null) {
try {
$ns->put( ConstCategoriesPage::PLUGIN_IS_ACTIVE, false, 'boolean');
# Url de base
$p_url = 'plugin.php?p='.ConstCategoriesPage::PARAM;
http::redirect($p_url);
}
catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
$active = $ns->get( ConstCategoriesPage::PLUGIN_IS_ACTIVE);
$msg = '';
if (!empty($_POST['saveconfig'])) {
try {
$active = (empty($_POST['active'])) ? false : true;
$ns->put( ConstCategoriesPage::PLUGIN_IS_ACTIVE, $active,'boolean');
$core->blog->triggerBlog();
$msg = dcPage::success( __('Configuration successfully updated.'), true, false, false);
}
catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
$page_title = __('Categories Page');
echo '
<html>
<head>
<title>'. $page_title.'</title>
</head>
<body>' .
dcPage::breadcrumb(
array(
html::escapeHTML($core->blog->name) => '',
'<span class="page-title">'.$page_title.'</span>' => ''
)).$msg.
'<div id="categoriesmode_options">
<form method="post" action="plugin.php">
<div class="fieldset">
<h4>'. __('Plugin config').'</h4>
<p class="field">
<label class=" classic">'. form::checkbox('active', 1, $active).'&nbsp;'.
__('Enable categoriesMode').
'</label>
</p>
</div>
<p>
<input type="hidden" name="p" value="'.ConstCategoriesPage::PARAM.'" />'.
$core->formNonce().
'<input type="submit" name="saveconfig" value="'. __('Save configuration').'" />
</p>
</form>
</div>
</body>
</html>';
}
}

View file

@ -24,15 +24,3 @@ msgstr "Activer la page des catégories"
msgid "Categories"
msgstr "Catégories"
msgid "Configuration successfully updated."
msgstr "La configuration a été mise à jour"
msgid "Plugin config"
msgstr "Configuration du plugin"
msgid "Enable categoriesMode"
msgstr "Activation du plugin"
msgid "Save configuration"
msgstr "Sauvegarde de la configuration"