Compare commits
2 commits
e6e2394d10
...
3c89d9d77b
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c89d9d77b | |||
| 48adc55bdc |
1 changed files with 237 additions and 116 deletions
|
|
@ -2,9 +2,9 @@
|
||||||
/**
|
/**
|
||||||
* THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION.
|
* THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION.
|
||||||
* @class Setting
|
* @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
|
* @brief gnuboard config extend class
|
||||||
* @version 1.1.1
|
* @version 1.1.2
|
||||||
* @license LGPL 2.1
|
* @license LGPL 2.1
|
||||||
*/
|
*/
|
||||||
class Setting
|
class Setting
|
||||||
|
|
@ -89,9 +89,15 @@ class Setting
|
||||||
case "color2":
|
case "color2":
|
||||||
$this->addColor2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addColor2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
case "color3":
|
||||||
|
$this->addBackForeLine($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
|
break;
|
||||||
case "border":
|
case "border":
|
||||||
$this->addBorderSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addBorderSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
case "border2":
|
||||||
|
$this->addBorder2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
|
break;
|
||||||
case "rect":
|
case "rect":
|
||||||
$this->addRectSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addRectSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
|
@ -193,6 +199,9 @@ class Setting
|
||||||
$count += count(array_filter($this->settings, function ($setting) {
|
$count += count(array_filter($this->settings, function ($setting) {
|
||||||
return $setting["type"] == "background";
|
return $setting["type"] == "background";
|
||||||
})) ? 3 : 0;
|
})) ? 3 : 0;
|
||||||
|
$count += count(array_filter($this->settings, function ($setting) {
|
||||||
|
return $setting["type"] == "color3";
|
||||||
|
})) ? 2 : 0;
|
||||||
return "<tr><th rowspan=\"{$count}\" scope=\"row\"><em>{$this->idx}</em>{$this->title}<input type=\"text\" name=\"cs_name[{$this->idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" /></th>";
|
return "<tr><th rowspan=\"{$count}\" scope=\"row\"><em>{$this->idx}</em>{$this->title}<input type=\"text\" name=\"cs_name[{$this->idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" /></th>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,6 +219,10 @@ class Setting
|
||||||
case "border":
|
case "border":
|
||||||
$count += 2;
|
$count += 2;
|
||||||
break;
|
break;
|
||||||
|
case "border2":
|
||||||
|
case "color3":
|
||||||
|
$count += 3;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$count++;
|
$count++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -272,6 +285,133 @@ class Setting
|
||||||
$this->is_value_added = true;
|
$this->is_value_added = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addBackgroundSetting($desc, $default)
|
||||||
|
{
|
||||||
|
if ($this->is_value_added)
|
||||||
|
return;
|
||||||
|
$idx = $this->getCurrentCount();
|
||||||
|
if ($idx == 0) {
|
||||||
|
$imgval = $this->cs_value;
|
||||||
|
$img = $this->cs_value ? "<img src=\"{$imgval}\" class=\"prev_thumb\"/>" : "이미지 미등록";
|
||||||
|
$color1 = $this->cs_etc_1;
|
||||||
|
$repeat = $this->cs_etc_2;
|
||||||
|
$align = $this->cs_etc_3;
|
||||||
|
$size = $this->cs_etc_4;
|
||||||
|
$position = $this->cs_etc_5 == "fixed" ? " selected" : "";
|
||||||
|
|
||||||
|
$repeats = ["", "", ""];
|
||||||
|
$aligns = ["", "", "", "", "", "", "", ""];
|
||||||
|
$sizes = ["", "", ""];
|
||||||
|
|
||||||
|
switch ($repeat) {
|
||||||
|
case "no-repeat":
|
||||||
|
$repeats[0] = " selected";
|
||||||
|
break;
|
||||||
|
case "repeat-x":
|
||||||
|
$repeats[1] = " selected";
|
||||||
|
break;
|
||||||
|
case "repeat-y":
|
||||||
|
$repeats[2] = " selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($align) {
|
||||||
|
case "left center":
|
||||||
|
$aligns[0] = " selected";
|
||||||
|
break;
|
||||||
|
case "left bottom":
|
||||||
|
$aligns[1] = " selected";
|
||||||
|
break;
|
||||||
|
case "center top":
|
||||||
|
$aligns[2] = " selected";
|
||||||
|
break;
|
||||||
|
case "center center":
|
||||||
|
$aligns[3] = " selected";
|
||||||
|
break;
|
||||||
|
case "center bottom":
|
||||||
|
$aligns[4] = " selected";
|
||||||
|
break;
|
||||||
|
case "right top":
|
||||||
|
$aligns[5] = " selected";
|
||||||
|
break;
|
||||||
|
case "right center":
|
||||||
|
$aligns[6] = " selected";
|
||||||
|
break;
|
||||||
|
case "right bottom":
|
||||||
|
$aligns[7] = " selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($size) {
|
||||||
|
case "contain":
|
||||||
|
$sizes[0] = " selected";
|
||||||
|
break;
|
||||||
|
case "cover":
|
||||||
|
$sizes[0] = " selected";
|
||||||
|
break;
|
||||||
|
case "100% 100%":
|
||||||
|
$sizes[0] = " selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->settings[] = [
|
||||||
|
"type" => "background",
|
||||||
|
"html" => "
|
||||||
|
<td rowspan=\"4\" class=\"bo-right bo-left txt-center\">
|
||||||
|
{$img}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">직접등록<input type=\"file\" name=\"cs_value_file[{$this->idx}]\" value=\"\" size=\"50\"></div>
|
||||||
|
</td></tr><tr>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">외부경로<input type=\"text\" name=\"cs_value[{$this->idx}]\" value=\"{$imgval}\" size=\"50\"/></div>
|
||||||
|
</td></tr><tr>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">색상<input type=\"text\" name=\"cs_etc_1[{$this->idx}]\" value=\"{$color1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div>
|
||||||
|
</td></tr><tr>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">배경반복
|
||||||
|
<select name=\"cs_etc_2[{$this->idx}]\">
|
||||||
|
<option value=\"\">반복</option>
|
||||||
|
<option value=\"no-repeat\"{$repeats[0]}>반복없음</option>
|
||||||
|
<option value=\"repeat-x\"{$repeats[1]}>가로반복</option>
|
||||||
|
<option value=\"repeat-y\"{$repeats[2]}>세로반복</option>
|
||||||
|
</select>
|
||||||
|
배경위치
|
||||||
|
<select name=\"cs_etc_3[{$this->idx}]\">
|
||||||
|
<option value=\"\">왼쪽 상단</option>
|
||||||
|
<option value=\"left center\"{$aligns[0]}>왼쪽 중단</option>
|
||||||
|
<option value=\"left bottom\"{$aligns[1]}>왼쪽 하단</option>
|
||||||
|
|
||||||
|
<option value=\"center top\"{$aligns[2]}>중간 상단</option>
|
||||||
|
<option value=\"center center\"{$aligns[3]}>중간 중단</option>
|
||||||
|
<option value=\"center bottom\"{$aligns[4]}>중간 하단</option>
|
||||||
|
|
||||||
|
<option value=\"right top\"{$aligns[5]}>오른쪽 상단</option>
|
||||||
|
<option value=\"right center\"{$aligns[6]}>오른쪽 중단</option>
|
||||||
|
<option value=\"right bottom\"{$aligns[7]}>오른쪽 하단</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class=\"setter\">
|
||||||
|
배경크기
|
||||||
|
<select name=\"cs_etc_4[{$this->idx}]\">
|
||||||
|
<option value=\"\">원본크기</option>
|
||||||
|
<option value=\"contain\"{$sizes[0]}>맞춤</option>
|
||||||
|
<option value=\"cover\"{$sizes[1]}>꽉참</option>
|
||||||
|
<option value=\"100% 100%\"{$sizes[2]}>늘이기</option>
|
||||||
|
</select>
|
||||||
|
고정
|
||||||
|
<select name=\"cs_etc_5[{$this->idx}]\">
|
||||||
|
<option value=\"\">스크롤</option>
|
||||||
|
<option value=\"fixed\"{$position}>고정</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function addFontSetting($desc, $default, $placeholder = "")
|
public function addFontSetting($desc, $default, $placeholder = "")
|
||||||
{
|
{
|
||||||
$idx = $this->getCurrentCount() + 1;
|
$idx = $this->getCurrentCount() + 1;
|
||||||
|
|
@ -478,7 +618,7 @@ class Setting
|
||||||
"outset" => "외부"
|
"outset" => "외부"
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($idx <= self::$etc_max - 1) {
|
if ($idx <= self::$etc_max - 2) {
|
||||||
$idx2 = $idx + 1;
|
$idx2 = $idx + 1;
|
||||||
$key1 = "cs_etc_{$idx}";
|
$key1 = "cs_etc_{$idx}";
|
||||||
$key2 = "cs_etc_{$idx2}";
|
$key2 = "cs_etc_{$idx2}";
|
||||||
|
|
@ -501,129 +641,110 @@ class Setting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addBackgroundSetting($desc, $default)
|
public function addBorder2Setting($desc, $default)
|
||||||
{
|
{
|
||||||
if ($this->is_value_added)
|
$idx = $this->getCurrentCount() + 1;
|
||||||
return;
|
$options = [
|
||||||
$idx = $this->getCurrentCount();
|
" " => "사용 안 함",
|
||||||
if ($idx == 0) {
|
"dotted" => "점선",
|
||||||
$imgval = $this->cs_value;
|
"dashed" => "대시",
|
||||||
$img = $this->cs_value ? "<img src=\"{$imgval}\" class=\"prev_thumb\"/>" : "이미지 미등록";
|
"solid" => "직선",
|
||||||
$color1 = $this->cs_etc_1;
|
"double" => "이중선",
|
||||||
$repeat = $this->cs_etc_2;
|
"groove" => "내부 경사",
|
||||||
$align = $this->cs_etc_3;
|
"ridge" => "외부 경사",
|
||||||
$size = $this->cs_etc_4;
|
"inset" => "내부",
|
||||||
$position = $this->cs_etc_5 == "fixed" ? " selected" : "";
|
"outset" => "외부"
|
||||||
|
];
|
||||||
|
|
||||||
$repeats = ["", "", ""];
|
if ($idx <= self::$etc_max - 3) {
|
||||||
$aligns = ["", "", "", "", "", "", "", ""];
|
$idx2 = $idx + 1;
|
||||||
$sizes = ["", "", ""];
|
$idx3 = $idx + 2;
|
||||||
|
|
||||||
switch ($repeat) {
|
$key1 = "cs_etc_{$idx}";
|
||||||
case "no-repeat":
|
$key2 = "cs_etc_{$idx2}";
|
||||||
$repeats[0] = " selected";
|
$key3 = "cs_etc_{$idx3}";
|
||||||
break;
|
|
||||||
case "repeat-x":
|
if (is_array($default) && isset($default[0]) && isset($default[1])) {
|
||||||
$repeats[1] = " selected";
|
if (!isset($this->$key1))
|
||||||
break;
|
$this->$key1 = array_key_exists($default[0], $options) ? $default[0] : "";
|
||||||
case "repeat-y":
|
|
||||||
$repeats[2] = " selected";
|
if (!isset($this->$key2))
|
||||||
break;
|
$this->$key2 = intval($default[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($default) && isset($default[2])) {
|
||||||
switch ($align) {
|
if (!isset($this->$key3))
|
||||||
case "left center":
|
$this->$key3 = intval($default[2]);
|
||||||
$aligns[0] = " selected";
|
|
||||||
break;
|
|
||||||
case "left bottom":
|
|
||||||
$aligns[1] = " selected";
|
|
||||||
break;
|
|
||||||
case "center top":
|
|
||||||
$aligns[2] = " selected";
|
|
||||||
break;
|
|
||||||
case "center center":
|
|
||||||
$aligns[3] = " selected";
|
|
||||||
break;
|
|
||||||
case "center bottom":
|
|
||||||
$aligns[4] = " selected";
|
|
||||||
break;
|
|
||||||
case "right top":
|
|
||||||
$aligns[5] = " selected";
|
|
||||||
break;
|
|
||||||
case "right center":
|
|
||||||
$aligns[6] = " selected";
|
|
||||||
break;
|
|
||||||
case "right bottom":
|
|
||||||
$aligns[7] = " selected";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($size) {
|
$values = explode("||", $this->$key3);
|
||||||
case "contain":
|
|
||||||
$sizes[0] = " selected";
|
$options_html = "";
|
||||||
break;
|
|
||||||
case "cover":
|
foreach ($options as $key => $val) {
|
||||||
$sizes[0] = " selected";
|
$k = trim($key);
|
||||||
break;
|
$s = $this->$key1 == $k ? " selected" : "";
|
||||||
case "100% 100%":
|
$options_html .= "<option value=\"{$k}\"{$s}>{$val}</option>";
|
||||||
$sizes[0] = " selected";
|
}
|
||||||
break;
|
|
||||||
|
$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" => "<td class=\"bo-right\">{$desc}</td>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">
|
||||||
|
<select name=\"cs_etc_{$idx}[{$this->idx}]\">{$options_html}</select>
|
||||||
|
두께<input type=\"number\" name=\"cs_etc_{$idx2}[{$this->idx}]\" value=\"{$this->$key2}\" placeholder=\"0\" title=\"두께\" style=\"width:45px;\"/>
|
||||||
|
</div>
|
||||||
|
<div class=\"setter\" style=\"margin-top: 8px\">
|
||||||
|
상<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_1_{$this->cs_name}\" style=\"max-width: 24px\" value=\"top\" {$checked_top}/>
|
||||||
|
하<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_2_{$this->cs_name}\" style=\"max-width: 24px\" value=\"bottom\" {$checked_bottom}/>
|
||||||
|
좌<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_3_{$this->cs_name}\" style=\"max-width: 24px\" value=\"left\" {$checked_left}/>
|
||||||
|
우<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_4_{$this->cs_name}\" style=\"max-width: 24px\" value=\"right\" {$checked_right}/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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}";
|
||||||
|
|
||||||
|
if (is_array($default)) {
|
||||||
|
$cnt = count($default);
|
||||||
|
switch($cnt) {
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
$this->$key3 = $default[2];
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
$this->$key2 = $default[1];
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
$this->$key1 = $default[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->settings[] = [
|
$this->settings[] = [
|
||||||
"type" => "background",
|
"type" => "color3",
|
||||||
"html" => "
|
"html" => "<td class=\"bo-right\">배경</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx}[{$this->idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>" .
|
||||||
<td rowspan=\"4\" class=\"bo-right bo-left txt-center\">
|
"<tr><td class=\"bo-right\">폰트</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx2}[{$this->idx}]\" value=\"{$this->$key2}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>" .
|
||||||
{$img}
|
"<tr><td class=\"bo-right\">라인</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx3}[{$this->idx}]\" value=\"{$this->$key3}\" class=\"neo_color\" size=\"20\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>"
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class=\"setter\">직접등록<input type=\"file\" name=\"cs_value_file[{$this->idx}]\" value=\"\" size=\"50\"></div>
|
|
||||||
</td></tr><tr>
|
|
||||||
<td>
|
|
||||||
<div class=\"setter\">외부경로<input type=\"text\" name=\"cs_value[{$this->idx}]\" value=\"{$imgval}\" size=\"50\"/></div>
|
|
||||||
</td></tr><tr>
|
|
||||||
<td>
|
|
||||||
<div class=\"setter\">색상<input type=\"text\" name=\"cs_etc_1[{$this->idx}]\" value=\"{$color1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div>
|
|
||||||
</td></tr><tr>
|
|
||||||
<td>
|
|
||||||
<div class=\"setter\">배경반복
|
|
||||||
<select name=\"cs_etc_2[{$this->idx}]\">
|
|
||||||
<option value=\"\">반복</option>
|
|
||||||
<option value=\"no-repeat\"{$repeats[0]}>반복없음</option>
|
|
||||||
<option value=\"repeat-x\"{$repeats[1]}>가로반복</option>
|
|
||||||
<option value=\"repeat-y\"{$repeats[2]}>세로반복</option>
|
|
||||||
</select>
|
|
||||||
배경위치
|
|
||||||
<select name=\"cs_etc_3[{$this->idx}]\">
|
|
||||||
<option value=\"\">왼쪽 상단</option>
|
|
||||||
<option value=\"left center\"{$aligns[0]}>왼쪽 중단</option>
|
|
||||||
<option value=\"left bottom\"{$aligns[1]}>왼쪽 하단</option>
|
|
||||||
|
|
||||||
<option value=\"center top\"{$aligns[2]}>중간 상단</option>
|
|
||||||
<option value=\"center center\"{$aligns[3]}>중간 중단</option>
|
|
||||||
<option value=\"center bottom\"{$aligns[4]}>중간 하단</option>
|
|
||||||
|
|
||||||
<option value=\"right top\"{$aligns[5]}>오른쪽 상단</option>
|
|
||||||
<option value=\"right center\"{$aligns[6]}>오른쪽 중단</option>
|
|
||||||
<option value=\"right bottom\"{$aligns[7]}>오른쪽 하단</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class=\"setter\">
|
|
||||||
배경크기
|
|
||||||
<select name=\"cs_etc_4[{$this->idx}]\">
|
|
||||||
<option value=\"\">원본크기</option>
|
|
||||||
<option value=\"contain\"{$sizes[0]}>맞춤</option>
|
|
||||||
<option value=\"cover\"{$sizes[1]}>꽉참</option>
|
|
||||||
<option value=\"100% 100%\"{$sizes[2]}>늘이기</option>
|
|
||||||
</select>
|
|
||||||
고정
|
|
||||||
<select name=\"cs_etc_5[{$this->idx}]\">
|
|
||||||
<option value=\"\">스크롤</option>
|
|
||||||
<option value=\"fixed\"{$position}>고정</option>
|
|
||||||
</select></div>
|
|
||||||
</td>"
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue