checkbox group
@param  string $name
@param  string $value
@param  array  $settings
@return string
490384
static public function checkbox_group($name, $value=null, $settings=[], $is_radio=false)
    {
        $form_type  = $is_radio ? 'radio' : 'checkbox';
        
        if (!$is_radio && strpos($name, '[]') === false) {
            $name .= '[]';
        }
        $settings = static::formatSettings($settings);
        
        $form_id = isset($settings['id']) ? $settings['id'] : static::formatId($name);
        unset($settings['id']);
        
        $classes = isset($settings['class']) ? explode(' ', $settings['class']) : [];
        $css_inline = (isset($settings['form-inline']) && $settings['form-inline'])|| in_array('inline', $classes) || in_array('list-inline', $classes) ? : false;
        $classes = array_diff($classes, ['inline', 'list-inline']);
        array_push($classes, 'ace');
        $settings['class'] = implode(' ', $classes);
        
        $str = sprintf('<ul class="control-group list-unstyled%s">', $css_inline ? ' list-inline' : '') . PHP_EOL;
        
        if ($settings['data_source']) {
            $fields     = $settings['fields'];
            foreach ($settings['data_source'] as $k => $v) {
                if (is_scalar($v)) {
                    $_value = $k;
                    $_title = $v;
                } else {
                    $_value = isset($v[$fields[0]]) ? $v[$fields[0]] : 0;
                    $_title = isset($v[$fields[1]]) ? $v[$fields[1]] : (isset($v['name']) ? $v['name'] : '无法解析名称');
                }
                // checked, if set value-bit(value like 1,2,4) then use bit type
                if (isset($settings['value-bit']) && $settings['value-bit']) {
                    $checked = (intval($value) & $_value) ? ' checked="checked"' : '';
                } else {
                    $checked_values = isset($settings['checked']) ? $settings['checked'] : $value;
                    $checked_values = is_null($checked_values) || $checked_values === '' ? [] : (array) $checked_values;
                    $checked = in_array($_value, $checked_values) ? ' checked="checked"' : '';
                }
                
                $str .= sprintf('<li class="%s">', $css_inline ? '' : 'list-group-item') . PHP_EOL;
                if (isset($v['depth'])) $str .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $v['depth']);
                $str .= '   <input type="'.$form_type.'" name="'. $name .'" value="'.$_value.'" class="' . $settings['class'] . '" data-group="'.$_title.'" '.$checked.' > ' . PHP_EOL;
                $str .= '   <span class="lbl"> '.$_title.' </span> ' . PHP_EOL;
                $str .= '</li>' . PHP_EOL;
            }
        } else {
            $str .= '<li>' . PHP_EOL;
            $str .= static::$form_type($name, $value, $settings);
            $str .= '</li>' . PHP_EOL;
        }
        
        $str .= '</ul>' . PHP_EOL;
        return $str;
    }
463062
static public function ueditor($name, $value=null, $settings=array())
    {
        if (empty($value)) {
            $value = "编辑内容";
        }
        
        $defultSettings = array(
            'width'     => "100%",
            'height'    => "400",
            'type'      => "simple",
            'js_mode'   => false
        );
        $settings = array_merge($defultSettings, $settings);
        
        $pluginFile = rtrim(Config::getWebRootPath(), '/') . '/lib/ueditor-1.4.3/use/ueditor.php';
        require_once($pluginFile);
        $UEditor = new \UEditor();
        $UEditor->basePath = Config::getRootUrl() . '/lib/ueditor-1.4.3/';
        
        $config = $events = array();
        if (isset($GLOBALS['editor_toolbar'])) {
            $config['toolbars'] = $GLOBALS['editor_toolbar'][$settings['type']];
        }
        $config['minFrameHeight']       = $settings['height'];
        $config['initialFrameHeight']   = $settings['height'];
        $config['initialFrameWidth']    = $settings['width'];
        $config['autoHeightEnabled']    = false;
        
        if (!$settings['js_mode']) {
            $code = $UEditor->editor($name, $value, $config, $events);
        } else {
            $code = $UEditor->jseditor($name, $value, $config, $events);
        }
        return $code;
    }
214629
public static function colorpicker($name, $value = null, $options = array())
	{
		static $done;

		if ($done === null)
		{
			$done = array();
		}

		$readonly = isset($options['readonly']) && $options['readonly'] == 'readonly';
		$disabled = isset($options['disabled']) && $options['disabled'] == 'disabled';

		$options['class'] = 'input-colorpicker';

		$value = $value ? '#' . ltrim($value, '#') : '';

		if (!$readonly && !$disabled)
		{
			$id = self::getIdAttribute($name, $options);

			// Only display the triggers once for each control.
			if (!in_array($id, $done))
			{
				// Load the calendar behavior
				Behavior::colorpicker();

				$done[] = $id;
			}

			return '<span class="input-color">' . self::text($name, $value, $options) . '</span>';
		}

		return self::text($name . 'disabled', $value, $options) . self::hidden($name, $value, $options);
	}
63444
protected function checkbox($name, $label = null, $value = null, $note = null) {
		$data = is_array($value) ? $value + ['note' => $note] : (
			is_bool($value)
			? ['checked' => $value, 'note' => $note]
			: ['note' => $value]
		);
		return $this->field($name, Checkbox::class, $label, [
			'checked' => Checkbox::b($this->v($name), df_bool(dfa($data, 'checked')))
		] + $data);
	}
250221
public static function checkbox($name, $checked = false, $options = [])
    {
        self::exclure($options);

        return self::checked('checkbox', $name, $checked, $options);
    }
1118280
static public function fieldForm($field, $name, $value=null, $settings=[])
    {
        // format field
        $field = \Wslim\Cms\FieldHelper::formatField($field);
        
        if (!$name) {
            $name  = 'row[' . $field['field_name'] . ']';
        }
        
        // value 此处进行数据解码和反转义，当值不为空
        
        // settings 处理，合并加入 field 的一些选项
        foreach ($field as $k => $v) {
            if (strpos($k, 'form_') === 0) {
                $sk = $k == 'form_type' ? $k : str_replace('form_', '', $k);
                if (!isset($settings[$sk])) $settings[$sk] = $v;
            }
        }
        
        return static::auto($name, $value, $settings);
    }
352936
public function checkboxes($name, $label = null, $choices = [], $checkedValues = [], $inline = false, array $options = [])
    {
        $elements = '';

        foreach ($choices as $value => $choiceLabel) {
            $checked = in_array($value, (array) $checkedValues);

            $elements .= $this->checkboxElement($name, $choiceLabel, $value, $checked, $inline, $options);
        }

        $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $elements . $this->getFieldError($name) . $this->getHelpText($name, $options) . '</div>';

        return $this->getFormGroup($name, $label, $wrapperElement);
    }
445230
public function addSetting($name, $settings, $key = null)
	{
		$value = $this->settingExists($name,$key) ? $this->getSetting($name, $key) : null;

		if(is_array($settings))
		{
			$settings = array_merge((array)$value, $settings);
		}

		if($key)
		{
			$this->_settings[$name][$key] = $settings;
		}
		else
		{
			$this->_settings[$name] = $settings;
		}

		return $this;
	}
138843
function notemptyfield($value, $name) {
        $found = false;
        foreach ($value as $checkboxitem) {
            if (strval($checkboxitem) !== '') {
                $found = true;
                break;
            }
        }
        return $found;
    }
912878
public function checkbox(
        $name,
        $value = 1,
        $checked = null,
        $options = []
    ) {
        $checkable = parent::checkbox($name, $value, $checked, $options);

        return array_key_exists('label', $options) ?
            $this->wrapCheckable($options['label'], 'checkbox', $checkable) :
            $checkable;
    }
890384
protected function processValue(
        $value,
        array $settings,
        /*# bool */ $between = false
    )/*# : string */ {
        if (is_object($value)) {
            return $this->quoteObject($value, $settings);
        } elseif (is_array($value)) {
            return $this->processArrayValue($value, $settings, $between);
        } else {
            return $this->processScalarValue($value);
        }
    }
332849
static public function attachment($name, $value=null, $settings=[])
    {
        $settings['media_type'] = 'attachment';
        if (!isset($settings['preview_url'])) $settings['preview_url'] = Ioc::url('preview?metia_type=attachment');
        return static::image($name, $value, $settings);
    }
338527
public function group($name, $settings = null, $callback = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        $groupName = trim($name, '/');
        $group = [];
        $group['route'] = '/' . $groupName;
        $group['before'] = $group['after'] = null;

        if (is_null($callback)) {
            $callback = $settings;
        } else {
            $group['before'][] = (!isset($settings['before']) ? null : $settings['before']);
            $group['after'][]  = (!isset($settings['after']) ? null : $settings['after']);
        }

        $groupCount = count($this->groups);
        if ($groupCount > 0) {
            $list = [];
            foreach ($this->groups as $key => $value) {
                if (is_array($value['before'])) {
                    foreach ($value['before'] as $k => $v) {
                        $list['before'][] = $v;
                    }
                    foreach ($value['after'] as $k => $v) {
                        $list['after'][] = $v;
                    }
                }
            }

            if (! is_null($group['before'])) {
                $list['before'][] = $group['before'][0];
            }

            if (! is_null($group['after'])) {
                $list['after'][] = $group['after'][0];
            }

            $group['before'] = $list['before'];
            $group['after'] = $list['after'];
        }

        $group['before'] = array_values(array_unique( (array) $group['before']));
        $group['after'] = array_values(array_unique( (array) $group['after']));

        array_push($this->groups, $group);

        if (is_object($callback)) {
            call_user_func_array($callback, [$this]);
        }

        $this->endGroup();

        return true;
    }
499822
public static function radio(
        $name,
        $value,
        $checkedValue = null,
        array $htmlOptions = []
    ) {
    	$radio = self::input('radio', $name, $value);
    	if ($checkedValue == $value) {
    		$radio .= ' checked="checked"';
    	}
    	$radio .= self::htmlOptions($htmlOptions) .'>';
    	return $radio;
    }
494691
public function checkboxes($name, array $list = [], $checked = null, array $options = [], $separator = '<br>')
    {
        $group = [];
        $name = \str_replace('[]', '', $name);

        foreach ($list as $id => $label) {
            $group[] = $this->generateCheckboxByGroup($id, $label, $name, $checked, $options);
        }

        return \implode($separator, $group);
    }
629666
public function set($name, $value)
    {
        list($key, $extra) = $this->_splitOptionName($name);
        if ($extra && !isset($this->_options[$key])) {
            $this->option($key, ['group' => true, 'array' => true]);
        }
        return $this->_values[$key][$extra] = $value;
    }
1096242
public static function inputRadio(string $name = '', string $value = '', bool $checked = false,
                                      array $attributes = []): string
    {
        $defaultAttributes = ['method-get' => false, 'class' => 'form-radio'];
        $userAttributes = \array_merge($defaultAttributes, $attributes);
        $attributes = [];
        $attributes['type'] = 'radio';
        $attributes['name'] = $userAttributes['method-get'] === false ? \sprintf('MFVARS[%s]', $name) : $name;
        $attributes['value'] = \htmlspecialchars((string)$value);
        $attributes['id'] = isset($userAttributes['id'])
            ? $userAttributes['id']
            : \sprintf('rb_%s_%s', $name, $value);
        $userAttributes = static::clearAttributes($userAttributes, ['method-get', 'id']);

        if ($checked === true) {
            $attributes['checked'] = 'checked';
        }

        return Tags::input(array_merge($attributes, $userAttributes));
    }