?> </h1> <form action="<?php echo get_url("plugin/themer/savesettings"); ?> " method="post"> <table class="fieldset" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="label"><label for="settings-sidebar_width"><?php echo __("Select an admin theme"); ?> </label></td> <td class="field"> <?php $pawed = array(); foreach (Setting::getThemes() as $key => $found) { if (in_array($key, array("fox", "wint", "wordpress-3.8"))) { $pawed[$key] = ucwords(str_replace("-", " ", $found)); } } if (count($pawed) == 0) { echo "<i>" . __("No pawedWolf admin theme found!") . "</i>"; } else { ?> <select name="settings[theme]"><?php foreach ($pawed as $paw => $title) { ?> <option value="<?php echo $paw; ?> "><?php
| @file ./enable.php | @author svanlaere | @version 1.1.0 [1.0.0] - Stable | | @license GPL License | @copyright Copyright © 2015 svanlaere */ if (!defined("IN_CMS")) { exit; } // CHECK $error = true; if (version_compare(PHP_VERSION, "5.3.0") <= 0) { $error = "php"; } else { $themes = Setting::getThemes(); $supported = array("fox", "wint", "wordpress-3.8"); foreach ($themes as $key => $theme) { if (in_array($key, $supported)) { $error = false; break; } } } // PERFORM if ($error !== false) { if ($error !== "php") { Plugin::deactivate("themer"); Flash::set("error", __("This plugin requires a pawedWolf admin theme!")); } else { Plugin::deactivate("themer");
?> </td> </tr> <tr> <td class="label"><label for="setting_theme"><?php echo __('Administration Theme'); ?> </label></td> <td class="field"> <select class="select" id="setting_theme" name="setting[theme]" onchange="$('css_theme').href = '<?php echo CORE_FOLDER; ?> /admin/themes/' + this[this.selectedIndex].value + '/styles.css';"> <?php $current_theme = Setting::get('theme'); foreach (Setting::getThemes() as $code => $label) { ?> <option value="<?php echo $code; ?> "<?php if ($code == $current_theme) { echo ' selected="selected"'; } ?> ><?php echo __($label); ?> </option> <?php }
function savesettings() { if (!isset($_POST["settings"]) || !isset($_POST["settings"]["action"])) { Flash::set("error", __("Could not save settings, no settings found.")); } else { $action = $_POST["settings"]["action"]; if ($action == "theme") { $themes = array_keys(Setting::getThemes()); if (in_array($_POST["settings"]["theme"], $themes)) { $sql = "UPDATE " . TABLE_PREFIX . "setting SET value=:theme WHERE name='theme';"; Record::query($sql, array(":theme" => $_POST["settings"]["theme"])); Flash::set("success", __("The settings have been saved.")); } else { Flash::set("error", __("An error occured trying to save the settings.")); } } else { if ($action == "reset") { // RESET SETTINGS $settings = array("fox" => array("color" => "color.fox.css"), "wordpress-3.8" => array("color" => "default.css", "sidebar_width" => 180), "wint" => array("color" => "default.css", "sidebar_width" => 200, "responsive" => true)); $settings = $settings[$this->theme]; } else { // VALIDATE SETTINGS if (isset($_POST["settings"]["color"])) { $colors = array_keys($this->getColors()); if (in_array($_POST["settings"]["color"], $colors)) { $settings["color"] = $_POST["settings"]["color"]; } } if (isset($_POST["settings"]["sidebar_width"])) { if (is_numeric($_POST["settings"]["sidebar_width"])) { $settings["sidebar_width"] = (int) $_POST["settings"]["sidebar_width"]; } } if (isset($_POST["settings"]["responsive"])) { $settings["responsive"] = true; } else { if ($this->theme == "wint") { $settings["responsive"] = false; } } } // SET SETTINGS if (isset($settings)) { $insert = array(); $insert[$this->theme] = serialize($settings); $settings = Plugin::setAllSettings($insert, "themer"); } else { $settings = false; } if ($settings === true) { Flash::set("success", __("The settings have been saved.")); } else { Flash::set("error", __("An error occured trying to save the settings.")); } } } redirect(get_url("plugin/themer/settings")); die; }