<commit_before><?php

class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{

    public function init()
    {

        $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
        $this->setDecorators(array(
            array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
        ));

        $defaultFade = Application_Model_Preference::GetDefaultFade();
        if ($defaultFade == "") {
            $defaultFade = '0.5';
        }

        //Station name
        $this->addElement('text', 'stationName', array(
            'class'      => 'input_text',
            'label'      => _('Station Name'),
            'required'   => false,
            'filters'    => array('StringTrim'),
            'value' => Application_Model_Preference::GetStationName(),
            'decorators' => array(
                'ViewHelper'
            )
        ));

        //Default station fade
        $this->addElement('text', 'stationDefaultFade', array(
            'class'      => 'input_text',
            'label'      => _('Default Fade (s):'),
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(array($notEmptyValidator, 'regex', false,
                array('/^[0-9]{1,2}(\.\d{1})?$/',
                'messages' => _('enter a time in seconds 0{.0}')))),
            'value' => $defaultFade,
            'decorators' => array(
                'ViewHelper'
            )
        ));

        $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
        $third_party_api->setLabel(
            sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
        $third_party_api->setMultiOptions(array(_("Disabled"),
                                            _("Enabled")));
        $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
        $third_party_api->setDecorators(array('ViewHelper'));
        $this->addElement($third_party_api);

        $locale = new Zend_Form_Element_Select("locale");
        $locale->setLabel(_("Default Interface Language"));
        $locale->setMultiOptions(Application_Model_Locale::getLocales());
        $locale->setValue(Application_Model_Preference::GetDefaultLocale());
        $locale->setDecorators(array('ViewHelper'));
        $this->addElement($locale);

        /* Form Element for setting the Timezone */
        $timezone = new Zend_Form_Element_Select("timezone");
        $timezone->setLabel(_("Default Interface Timezone"));
        $timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
        $timezone->setValue(Application_Model_Preference::GetDefaultTimezone());
        $timezone->setDecorators(array('ViewHelper'));<commit_msg>CC-4926: System-> Preference: Please limit the default fade value less than 60<commit_after><?php

class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{

    public function init()
    {

        $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
        $rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
        $this->setDecorators(array(
            array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
        ));

        $defaultFade = Application_Model_Preference::GetDefaultFade();
        if ($defaultFade == "") {
            $defaultFade = '0.5';
        }

        //Station name
        $this->addElement('text', 'stationName', array(
            'class'      => 'input_text',
            'label'      => _('Station Name'),
            'required'   => false,
            'filters'    => array('StringTrim'),
            'value' => Application_Model_Preference::GetStationName(),
            'decorators' => array(
                'ViewHelper'
            )
        ));

        //Default station fade
        $this->addElement('text', 'stationDefaultFade', array(
            'class'      => 'input_text',
            'label'      => _('Default Fade (s):'),
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array(
                    $rangeValidator,
                    $notEmptyValidator,
                    'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}'))
                )
            ),
            'value' => $defaultFade,
            'decorators' => array(
                'ViewHelper'
            )
        ));

        $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
        $third_party_api->setLabel(
            sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
        $third_party_api->setMultiOptions(array(_("Disabled"),
                                            _("Enabled")));
        $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
        $third_party_api->setDecorators(array('ViewHelper'));
        $this->addElement($third_party_api);

        $locale = new Zend_Form_Element_Select("locale");
        $locale->setLabel(_("Default Interface Language"));
        $locale->setMultiOptions(Application_Model_Locale::getLocales());
        $locale->setValue(Application_Model_Preference::GetDefaultLocale());
        $locale->setDecorators(array('ViewHelper'));
        $this->addElement($locale);

        /* Form Element for setting the Timezone */
        $timezone = new Zend_Form_Element_Select("timezone");
        $timezone->setLabel(_("Default Interface Timezone"));
        $timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
        $timezone->setValue(Application_Model_Preference::GetDefaultTimezone());
        $timezone->setDecorators(array('ViewHelper'));
{'fraction_non_alphanumeric': 0.14276116896204233, 'fraction_numerical': 0.0050386294927779645, 'mean_word_length': 2.494718309859155, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '8106', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1579, 'n_words': 258}