From 48adc55bdc15c6f55c5d6ce2e4bd13fac73d5290 Mon Sep 17 00:00:00 2001 From: Arcturus Date: Mon, 10 Feb 2025 01:53:49 +0900 Subject: [PATCH] update --- .../classes/setting/setting.class.php | 112 +++++++++++++++++- 1 file changed, 108 insertions(+), 4 deletions(-) diff --git a/AvocadoAmber/classes/setting/setting.class.php b/AvocadoAmber/classes/setting/setting.class.php index cc3e9ef..5f7f7fa 100644 --- a/AvocadoAmber/classes/setting/setting.class.php +++ b/AvocadoAmber/classes/setting/setting.class.php @@ -2,9 +2,9 @@ /** * THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION. * @class Setting - * @author arcturus (contact@sharlayan.net / https://info.drk.st/about) + * @author amberstone ( contact@drk.st / https://amberst.one ) * @brief gnuboard config extend class - * @version 1.1.1 + * @version 1.1.2 * @license LGPL 2.1 */ class Setting @@ -89,9 +89,15 @@ class Setting case "color2": $this->addColor2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []); break; + case "color3": + $this->addBackForeLine($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []); + break; case "border": $this->addBorderSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []); break; + case "border2": + $this->addBorder2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []); + break; case "rect": $this->addRectSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []); break; @@ -193,6 +199,9 @@ class Setting $count += count(array_filter($this->settings, function ($setting) { return $setting["type"] == "background"; })) ? 3 : 0; + $count += count(array_filter($this->settings, function ($setting) { + return $setting["type"] == "color3"; + })) ? 2 : 0; return "{$this->idx}{$this->title}idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" />"; } @@ -210,6 +219,10 @@ class Setting case "border": $count += 2; break; + case "border2": + case "color3": + $count += 3; + break; default: $count++; break; @@ -478,7 +491,7 @@ class Setting "outset" => "외부" ]; - if ($idx <= self::$etc_max - 1) { + if ($idx <= self::$etc_max - 2) { $idx2 = $idx + 1; $key1 = "cs_etc_{$idx}"; $key2 = "cs_etc_{$idx2}"; @@ -501,6 +514,77 @@ class Setting } } + public function addBorder2Setting($desc, $default) + { + $idx = $this->getCurrentCount() + 1; + $options = [ + " " => "사용 안 함", + "dotted" => "점선", + "dashed" => "대시", + "solid" => "직선", + "double" => "이중선", + "groove" => "내부 경사", + "ridge" => "외부 경사", + "inset" => "내부", + "outset" => "외부" + ]; + + if ($idx <= self::$etc_max - 3) { + $idx2 = $idx + 1; + $idx3 = $idx + 2; + + $key1 = "cs_etc_{$idx}"; + $key2 = "cs_etc_{$idx2}"; + $key3 = "cs_etc_{$idx3}"; + + if (is_array($default) && isset($default[0]) && isset($default[1])) { + if (!isset($this->$key1)) + $this->$key1 = array_key_exists($default[0], $options) ? $default[0] : ""; + + if (!isset($this->$key2)) + $this->$key2 = intval($default[1]); + } + + if (is_array($default) && isset($default[2])) { + if (!isset($this->$key3)) + $this->$key3 = intval($default[2]); + } + + $values = explode("||", $this->$key3); + + $options_html = ""; + + foreach ($options as $key => $val) { + $k = trim($key); + $s = $this->$key1 == $k ? " selected" : ""; + $options_html .= ""; + } + + $checked_top = in_array("top", $values) ? " checked" : ""; + $checked_bottom = in_array("bottom", $values) ? " checked" : ""; + $checked_left = in_array("left", $values) ? " checked" : ""; + $checked_right = in_array("right", $values) ? " checked" : ""; + + $this->settings[] = [ + "type" => "border", + "html" => "{$desc} + +
+ + 두께idx}]\" value=\"{$this->$key2}\" placeholder=\"0\" title=\"두께\" style=\"width:45px;\"/> +
+
+ 상idx}][]\" id=\"cs_etc_{$idx3}_1_{$this->cs_name}\" style=\"max-width: 24px\" value=\"top\" {$checked_top}/> + 하idx}][]\" id=\"cs_etc_{$idx3}_2_{$this->cs_name}\" style=\"max-width: 24px\" value=\"bottom\" {$checked_bottom}/> + 좌idx}][]\" id=\"cs_etc_{$idx3}_3_{$this->cs_name}\" style=\"max-width: 24px\" value=\"left\" {$checked_left}/> + 우idx}][]\" id=\"cs_etc_{$idx3}_4_{$this->cs_name}\" style=\"max-width: 24px\" value=\"right\" {$checked_right}/> +
+ + " + ]; + } + } + public function addBackgroundSetting($desc, $default) { if ($this->is_value_added) @@ -531,7 +615,6 @@ class Setting break; } - switch ($align) { case "left center": $aligns[0] = " selected"; @@ -628,6 +711,27 @@ class Setting } } + public function addBackForeLine($desc, $default) + { + $idx = $this->getCurrentCount() + 1; + if ($idx <= self::$etc_max - 3) { + $key1 = "cs_etc_{$idx}"; + + $idx2 = $idx + 1; + $key2 = "cs_etc_{$idx2}"; + + $idx3 = $idx + 2; + $key3 = "cs_etc_{$idx3}"; + + $this->settings[] = [ + "type" => "color3", + "html" => "배경
색상 idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" />
" . + "폰트
색상 idx}]\" value=\"{$this->$key2}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" />
" . + "라인
색상 idx}]\" value=\"{$this->$key3}\" class=\"neo_color\" size=\"20\" maxlength=\"255\" placeholder=\"#색상코드\" />
" + ]; + } + } + public function addSelectSetting($desc, $default, $values) { $idx = $this->getCurrentCount() + 1;