' . lang('Created with Kumquat Framework') . '
' ], ``` ### 密码输入框 ```php /** * @return string */ 'demo-password' => [ 'label' => '密码输入框', 'description' => 'Password input box', 'type' => 'password', 'default' => 'password' ], ``` ### 隐藏项 少见。 ```php /** * @return mixed */ 'demo-hidden' => [ 'label' => '隐藏项', 'description' => 'Hidden', 'type' => 'hidden', 'default' => lang('Created with Kumquat Framework') ], ``` ## 金桔框架表单控件 ### 扩展表单控件 #### 切换开关 和“是/否 单选框”一样,但更好看。 ```php /** * @return int|bool */ 'demo_toggle' => [ 'label' => '切换开关 单选框', 'description' => 'Toggle Switch Radio box', 'type' => 'toggle', 'default' => false ], ``` #### 按钮组切换 单选框 和一般单选框一样,但更好看。 ```php /** * @return int|bool */ 'demo_radio-toggle' => [ 'label' => '按钮组切换 单选框', 'description' => 'Button Group Toggle Radio box', 'type' => 'radio-toggle', 'default' => 'blue', 'choices' => [ 'red' => 'Red', 'blue' => 'Blue', 'green' => 'Green', 'purple' => 'Purple', ], ], ``` #### 网址输入框 浏览器帮你校验。 ```php /** * @return string */ 'demo-url' => [ 'label' => '网址输入框', 'description' => 'URL input box', 'type' => 'url', 'default' => isset($_SERVER) ? 'https://' . $_SERVER['HTTP_HOST'] : 'https://www.example.org/' ], ``` #### Email输入框 浏览器帮你校验。 ```php /** * @return string */ 'demo-email' => [ 'label' => '电子邮件地址输入框', 'description' => 'Email input box', 'type' => 'email', 'default' => isset($user) ? $user['email'] : 'kurumichan0822@example.org' ], ``` #### 日期与时间输入框 浏览器帮你校验。 ```php /** * @return string * @example 2022-02-02 */ 'demo-date' => [ 'label' => '日期输入框', 'description' => 'Date input box', 'type' => 'date', 'default' => date('Y-m-d') ], ``` ```php /** * @return string * @example 2022-W01 */ 'demo-week' => [ 'label' => '周输入框', 'description' => 'Week input box', 'type' => 'week', 'default' => date('Y-\WW') ], ``` ```php /** * @return string * @example 12:34 */ 'demo-time' => [ 'label' => '时间输入框', 'description' => 'Time input box', 'type' => 'time', 'default' => date('H:i') ], ``` ```php /** * @return string * @example 2022-01-01T12:34 */ 'demo-datetime' => [ 'label' => '日期时间输入框', 'description' => 'Date and time input box', 'type' => 'datetime', 'default' => date('Y-m-d\TH:i') ], ``` #### 数字输入框 浏览器帮你校验。 ```php /** * @return int|float */ 'demo-number' => [ 'label' => '数字输入框', 'description' => 'Number input box', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 100, 'step' => 5 ], ``` #### 滑竿输入框 ```php /** * @return int|float */ 'demo-range' => [ 'label' => '滑竿输入框', 'description' => 'Slider input', 'type' => 'range', 'default' => 10, 'min' => 0, 'max' => 100, 'step' => 5, 'show_label' => 1 ], ``` #### 带有图片的单选框 普通单选框的变体。 ```php /** * @return string */ 'demo-radio-image' => [ 'label' => '带有图片的单选框', 'description' => 'Radio box with image', 'type' => 'radio-image', 'choices' => [ [ 'label' => 'guy running', 'url' => 'https://via.placeholder.com/256', ], [ 'label' => 'couple', 'url' => 'https://via.placeholder.com/257', ], [ 'label' => 'gal running', 'url' => 'https://via.placeholder.com/258', ], ], 'default' => 1 ], ``` #### 颜色选择框 浏览器帮你校验。带有“重置”按钮,可将颜色设置为默认值。 ```php /** * @return string */ 'demo-color-picker' => [ 'label' => '颜色选择框', 'description' => 'Color selection box', 'type' => 'color', 'default' => '#66ccff', ], ``` #### 颜色选择 单选框 普通单选框的变体。 ```php /** * @return string */ 'demo-color-select' => [ 'label' => '颜色选择 单选框', 'description' => 'Color selection radio box', 'type' => 'color-select', 'default' => 'blue', 'choices' => [ 'red' => 'Red', 'blue' => 'Blue', 'green' => 'Green', 'purple' => 'Purple', ], ], ``` #### 配色方案 单选框 上一个的变体,可容纳任意数量的颜色。 ```php /** * @return string */ 'demo-colorschemes' => [ 'label' => '配色方案 单选框', 'description' => 'Color scheme radio box', 'type' => 'color_schemes', 'default' => 'green', 'choices' => [ 'red' => [ 'label' => 'Red', 'colors' => ['#993300', '#CC3300', '#FF3333', '#FF6666'] ], 'blue' => [ 'label' => 'Blue', 'colors' => ['#0066FF', '#0099FF', '#00CCFF'], ], 'green' => [ 'label' => 'Green', 'colors' => ['#009900', '#00CC66'] ], 'purple' => [ 'label' => 'Purple', 'colors' => ['#9933ff'] ], ], ], ``` ### 专用表单控件(复合控件) #### CSS字体选择 可视化调整CSS字体属性。 ```php /** * @return array */ 'heading_typo' => array( 'label' => '标题字体', 'type' => 'css_typography', 'args' => array( /* 复写参数 */ 'font-size' => 1.75 , 'font-size_unit' => 'rem' , 'line-height' => 1.2 , ), 'default' => array( /* 默认值 */ 'font-family'=>'sans-serif' , 'font-style' => 'normal' , 'font-weight' => 500 , 'font-size' => 1.75 , 'font-size_unit' => 'rem' , 'line-height' => 1.2 , ), ), ``` #### 背景图片选择 可视化调整背景图片展示方式。 ```php /** * @return array */ 'demo-bgimage' => array( 'label' => '背景图像 组合输入框,包含背景图片位置、重复方式、位置、尺寸、固定方式', 'description' => 'Background Image combination input box with background-url,background-repeat,background-position,background-size,background-attachment', 'type' => 'css_background_image', 'args' => array( 'choices' => array( /* 预设图片地址下拉框的内容,若不写此项,则不显示下拉框 */ 'running' => [ 'href' => 'https://via.placeholder.com/256', 'label' => 'guy running' ], 'couple' => [ 'href' => 'https://via.placeholder.com/257', 'label' => 'couple' ], ), ), 'default' => array( /* 默认值 */ 'choices' => 'couple', 'background-url' => 'https://via.placeholder.com/468x60?text=Visit+Blogging.com+Now', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => '100%', 'background-attachment' => 'scroll' ) ) ``` ### Xiuno BBS 专用表单元素 这些控件专为Xiuno BBS设计。 #### 论坛板块选择 ```php 'demo-forums' => [ 'label' => '论坛板块选择 单选框', 'description' => 'Forum selection radio box', 'type' => 'forumlist', 'default' => 1, /* 默认值:填写板块ID */ ], 'demo-forums_multi' => [ 'label' => '论坛板块选择 多选框', 'description' => 'Forum selection checkbox', 'type' => 'forumlist_multi', 'default' => [1,2,3], /* 默认值:填写板块ID数组 */ ], 'demo-forums_dropdown' => [ 'label' => '论坛板块选择 下拉框', 'description' => 'Dropdown for each forum', 'type' => 'forumlist_dropdown', 'default' => 1, ], 'demo-dropdown_per_forum' => [ 'label' => '每个论坛板块使用一种下拉框', 'description' => 'Use one dropdown box per forum board', 'type' => 'dropdown_per_forum', 'choices' => [ 'red' => 'Red', 'blue' => 'Blue', 'green' => 'Green', 'purple' => 'Purple', ], 'default' => [1 => 'purple'], ], ``` #### 用户组选择 ```php 'demo-usergroup' => [ 'label' => '用户组选择 单选框', 'description' => 'User group selection radio box', 'type' => 'usergroup', 'default' => 101, /* 默认值:填写用户组ID */ ], 'demo-usergroup_multi' => [ 'label' => '论坛板块选择 单选框', 'description' => 'User group selection checkbox', 'type' => 'usergroup_multi', 'default' => [1, 101, 102, 103], /* 默认值:填写用户组ID数组 */ ], ``` # 实用函数 ## 获取指定插件的地址 在制作一些和前端页面打交道的插件(如主题)时很有用。 ```php ``` # 实用变量 ## `$PLUGIN_PROFILE` `conf.json`的PHP数组版。可在`setting.php`中使用。 # 注意 本框架使用了来自[字节跳动静态资源公共库](http://cdn.bytedance.com/)的 TinyMCE 编辑器,根据《字节跳动静态资源公共库用户协议》,您不应将本框架用于不符合中国现行法律、法规,有违公序良俗的使用场景。 因使用本框架导致的任何损失,框架作者概不负责。 # 作者 - Geticer - 主要作者 - Tillreetree - 开发协力 - 七濑胡桃 - 精神支持 # 许可 MIT Licence # 鸣谢 1. Acid WordPress Customizer Framework - 灵感来源和设置项结构借鉴