<commit_before><?php
/**
 * @package KVD.html
 * @author <NAME> <<EMAIL>>
 * @version $Id: KVDhtml_FormField.class.php,v 1.1 2006/01/12 12:30:14 Koen Exp $
 */

/**
 * @package KVD.html
 * @author <NAME> <<EMAIL>>
 * @since 1.0.0
 */
abstract class KVDhtml_FormField
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $value;

    /**
     * @var string
     */
    protected $class;

    /**
     * @var string
     */
    protected $disabled;
    
    /**
     * @var string
     */
    protected $readonly;

    /**
     * @var string 
     */
    protected $fieldFormat = "<input type=\"%s\" name=\"%s\"%s%s%s%s/>\n";

    /**
     * @param array $fieldOptions
     */
    public function __construct( $fieldOptions=null )
    {
        if ( !is_null($fieldOptions) ) {
            $this->setField($fieldOptions);
        } else {
            $this->setField(array());
        }
    }

    /**
     * @param array $fieldOptions
     */
    protected function setField(&$fieldOptions)
    {
        $this->name = (isset($fieldOptions['name'])) ? $fieldOptions['name'] : '';
        $this->value = (isset($fieldOptions['value'])) ? $fieldOptions['value'] : '';
        $this->class = (isset($fieldOptions['class'])) ? $fieldOptions['class'] : '';
        $this->readonly = (isset($fieldOptions['readonly'])) ? $fieldOptions['readonly'] : '';
        $this->disabled = (isset($fieldOptions['disabled'])) ? $fieldOptions['disabled'] : '';
    }

    protected function toHtmlAttribClass()
    {
        if ($this->class != '') {
            $this->class = " class=\"{$this->class}\"";
        }
    }

    protected function toHtmlAttribValue()
    {
        if ($this->value != '') {
            $this->value = " value=\"{$this->value}\"";
        }
    }

    protected function toHtmlAttribReadonly()
    {
        if ($this->readonly === TRUE) {
            $this->readonly = " readonly";
        } 
    }

    protected function toHtmlAttribDisabled()
    {
        if ($this->disabled === TRUE) {
            $this->disabled = " disabled";
        } 
    }

    abstract public function toHtml();
    
}
?>
<commit_msg>Toevoegen van een attribuut voor checked.<commit_after><?php
/**
 * @package KVD.html
 * @author <NAME> <<EMAIL>>
 * @version $Id: KVDhtml_FormField.class.php,v 1.1 2006/01/12 12:30:14 Koen Exp $
 */

/**
 * @package KVD.html
 * @author <NAME> <<EMAIL>>
 * @since 1.0.0
 */
abstract class KVDhtml_FormField
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $value;

    /**
     * @var string
     */
    protected $class;

    /**
     * @var string
     */
    protected $disabled;
    
    /**
     * @var string
     */
    protected $readonly;

    /**
     * @var string
     */
    protected $checked;

    /**
     * @var string 
     */
    protected $fieldFormat = "<input type=\"%s\" name=\"%s\"%s%s%s%s%s/>\n";

    /**
     * @param array $fieldOptions
     */
    public function __construct( $fieldOptions=null )
    {
        if ( !is_null($fieldOptions) ) {
            $this->setField($fieldOptions);
        } else {
            $this->setField(array());
        }
    }

    /**
     * @param array $fieldOptions
     */
    protected function setField(&$fieldOptions)
    {
        $this->name = (isset($fieldOptions['name'])) ? $fieldOptions['name'] : '';
        $this->value = (isset($fieldOptions['value'])) ? $fieldOptions['value'] : '';
        $this->class = (isset($fieldOptions['class'])) ? $fieldOptions['class'] : '';
        $this->readonly = (isset($fieldOptions['readonly'])) ? $fieldOptions['readonly'] : '';
        $this->disabled = (isset($fieldOptions['disabled'])) ? $fieldOptions['disabled'] : '';
        $this->checked = ( isset($fieldOptions['checked'])) ? $fieldOptions['checked'] : '';
    }

    protected function toHtmlAttribClass()
    {
        if ($this->class != '') {
            $this->class = " class=\"{$this->class}\"";
        }
    }

    protected function toHtmlAttribValue()
    {
        if ($this->value != '') {
            $this->value = " value=\"{$this->value}\"";
        }
    }

    protected function toHtmlAttribReadonly()
    {
        if ($this->readonly == TRUE) {
            $this->readonly = " readonly";
        } 
    }

    protected function toHtmlAttribDisabled()
    {
        if ($this->disabled == TRUE) {
            $this->disabled = " disabled";
        } 
    }

    protected function toHtmlAttribChecked( )
    {
        if ( $this->checked == TRUE ) {
            $this->checked = " checked";
        }
    }

    abstract public function toHtml();
    
}
?>

{'fraction_non_alphanumeric': 0.1784841075794621, 'fraction_numerical': 0.007742461287693562, 'mean_word_length': 1.7828798185941044, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4902569', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1444, 'n_words': 256}