[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
| 13 | |
---|
| 14 | if (!isset($__resources['help']['themeEditor'])) { |
---|
| 15 | $__resources['help']['themeEditor'] = dirname(__FILE__).'/help.html'; |
---|
| 16 | } |
---|
| 17 | |
---|
[948] | 18 | $core->addBehavior('adminCurrentThemeDetails', array('themeEditorBehaviors','theme_editor_details')); |
---|
[0] | 19 | |
---|
[948] | 20 | $core->addBehavior('adminBeforeUserOptionsUpdate',array('themeEditorBehaviors','adminBeforeUserUpdate')); |
---|
| 21 | $core->addBehavior('adminPreferencesForm',array('themeEditorBehaviors','adminPreferencesForm')); |
---|
| 22 | |
---|
| 23 | class themeEditorBehaviors |
---|
[0] | 24 | { |
---|
[966] | 25 | public static function theme_editor_details($core,$id) |
---|
[948] | 26 | { |
---|
| 27 | if ($id != 'default' && $core->auth->isSuperAdmin()) { |
---|
[1382] | 28 | return '<p><a href="plugin.php?p=themeEditor" class="button">'.__('Edit theme files').'</a></p>'; |
---|
[948] | 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | public static function adminBeforeUserUpdate($cur,$userID) |
---|
| 33 | { |
---|
| 34 | global $core; |
---|
| 35 | |
---|
| 36 | // Get and store user's prefs for plugin options |
---|
| 37 | $core->auth->user_prefs->addWorkspace('interface'); |
---|
| 38 | try { |
---|
| 39 | $core->auth->user_prefs->interface->put('colorsyntax',!empty($_POST['colorsyntax']),'boolean'); |
---|
| 40 | } |
---|
| 41 | catch (Exception $e) |
---|
| 42 | { |
---|
| 43 | $core->error->add($e->getMessage()); |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public static function adminPreferencesForm($core) |
---|
| 48 | { |
---|
| 49 | // Add fieldset for plugin options |
---|
| 50 | $core->auth->user_prefs->addWorkspace('interface'); |
---|
| 51 | |
---|
[1609] | 52 | echo |
---|
[998] | 53 | '<p><label for="colorsyntax" class="classic">'. |
---|
[1454] | 54 | form::checkbox('colorsyntax',1,$core->auth->user_prefs->interface->colorsyntax).'</label>'. |
---|
[1609] | 55 | __('Syntax color for theme editor'). |
---|
| 56 | '</p>'; |
---|
[0] | 57 | } |
---|
| 58 | } |
---|
| 59 | ?> |
---|