<commit_before><?php
/*"******************************************************************************************************
*   (c) 2007-2015 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
********************************************************************************************************/

/**
 * An list of tags which can be added or removed.
 *
 * @author <EMAIL>
 * @since 4.7
 * @package module_formgenerator
 */
class class_formentry_tageditor extends class_formentry_multiselect {

    protected $strOnChangeCallback;

    public function setOnChangeCallback($strOnChangeCallback) {
        $this->strOnChangeCallback = $strOnChangeCallback;

        return $this;
    }

    /**
     * Renders the field itself.
     * In most cases, based on the current toolkit.
     *
     * @return string
     */
    public function renderField()
    {
        $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
        $strReturn = "";
        if($this->getStrHint() != null) {
            $strReturn .= $objToolkit->formTextRow($this->getStrHint());
        }

        $strReturn.= $objToolkit->formInputTagEditor($this->getStrEntryName(), $this->getStrLabel(), $this->arrKeyValues, $this->strOnChangeCallback);
        return $strReturn;
    }

    public function setValueToObject()
    {
        $objSourceObject = $this->getObjSourceObject();
        if($objSourceObject == null)
            return "";

        $objReflection = new class_reflection($objSourceObject);
        $strSetter = $objReflection->getSetter($this->getStrSourceProperty());
        if($strSetter === null)
            throw new class_exception("unable to find setter for value-property ".$this->getStrSourceProperty()."@".get_class($objSourceObject), class_exception::$level_ERROR);

        return call_user_func(array($objSourceObject, $strSetter), json_encode(explode(",", $this->getStrValue())));
    }

    public function validateValue()
    {
        $arrValues = explode(",", $this->getStrValue());
        foreach($arrValues as $strValue) {
            $strValue = trim($strValue);
            if(empty($strValue)) {
                return false;
            }
        }

        return true;
    }
}
<commit_msg>UPDATE: module_system | class_formentry_tageditor > add method getValueAsText<commit_after><?php
/*"******************************************************************************************************
*   (c) 2007-2015 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
********************************************************************************************************/

/**
 * An list of tags which can be added or removed.
 *
 * @author <EMAIL>
 * @since 4.7
 * @package module_formgenerator
 */
class class_formentry_tageditor extends class_formentry_multiselect {

    protected $strOnChangeCallback;

    public function setOnChangeCallback($strOnChangeCallback) {
        $this->strOnChangeCallback = $strOnChangeCallback;

        return $this;
    }

    /**
     * Renders the field itself.
     * In most cases, based on the current toolkit.
     *
     * @return string
     */
    public function renderField()
    {
        $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
        $strReturn = "";
        if($this->getStrHint() != null) {
            $strReturn .= $objToolkit->formTextRow($this->getStrHint());
        }

        $strReturn.= $objToolkit->formInputTagEditor($this->getStrEntryName(), $this->getStrLabel(), $this->arrKeyValues, $this->strOnChangeCallback);
        return $strReturn;
    }

    public function setValueToObject()
    {
        $objSourceObject = $this->getObjSourceObject();
        if($objSourceObject == null)
            return "";

        $objReflection = new class_reflection($objSourceObject);
        $strSetter = $objReflection->getSetter($this->getStrSourceProperty());
        if($strSetter === null)
            throw new class_exception("unable to find setter for value-property ".$this->getStrSourceProperty()."@".get_class($objSourceObject), class_exception::$level_ERROR);

        return call_user_func(array($objSourceObject, $strSetter), json_encode(explode(",", $this->getStrValue())));
    }

    public function validateValue()
    {
        $arrValues = explode(",", $this->getStrValue());
        foreach($arrValues as $strValue) {
            $strValue = trim($strValue);
            if(empty($strValue)) {
                return false;
            }
        }

        return true;
    }

    public function getValueAsText() {
        return implode(", ", $this->arrKeyValues);
    }
}

{'fraction_non_alphanumeric': 0.20097939196082432, 'fraction_numerical': 0.004896959804121608, 'mean_word_length': 2.7563218390804596, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4042674', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1263, 'n_words': 251}