<commit_before><?php

// this is not getting loaded by autloading since it has a classname
// that makes it clash with how zf1 expects to load plugins.
require_once 'customfilters/ImageSize.php';

class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{

    public function init()
    {
        $maxLens = Application_Model_Show::getMaxLengths();
        $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);

        $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'))
        ));

        $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
        $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();

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

        // Station description
        $stationDescription = new Zend_Form_Element_Textarea("stationDescription");
        $stationDescription->setLabel(_('Station Description'));
        $stationDescription->setValue(Application_Model_Preference::GetStationDescription());
        $stationDescription->setRequired(false);
        $stationDescription->setValidators(array(array('StringLength', false, array(0, $maxLens['description']))));
        $stationDescription->setAttrib('rows', 4);
        $this->addElement($stationDescription);

        // Station Logo
        $stationLogoUpload = new Zend_Form_Element_File('stationLogo');
        $stationLogoUpload->setLabel(_('Station Logo:'))
            ->setDescription(_("Note: Anything larger than 600x600 will be resized."))
            ->setRequired(false)
            ->addValidator('Count', false, 1)
            ->addValidator('Extension', false, 'jpg,jpeg,png,gif')
            ->setMaxFileSize(1000000)
            ->addFilter('ImageSize');
        $stationLogoUpload->setAttrib('accept', 'image/*');
        $this->addElement($stationLogoUpload);

        $stationLogoRemove = new Zend_Form_Element_Button('stationLogoRemove');
        $stationLogoRemove->setLabel(_('Remove'));
        $stationLogoRemove->setAttrib('class', 'btn');
        $stationLogoRemove->setAttrib('id', 'logo-remove-btn');
        $stationLogoRemove->setAttrib('onclick', 'removeLogo();');
        $this->addElement($stationLogoRemove);

        //Default station crossfade duration
        $this->addElement('text', 'stationDefaultCrossfadeDuration', array(
            'class' => 'input_text',
            'label' => _('Default Crossfade Duration (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                    $rangeValidator,
                    $notEmptyValidator,
                    array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(),
        ));

        //Default station fade in
        $this->addElement('text', 'stationDefaultFadeIn', array(
            'class' => 'input_text',
            'label' => _('Default Fade In (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                $rangeValidator,
                $notEmptyValidator,
                array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => $defaultFadeIn,
        ));

        //Default station fade out
        $this->addElement('text', 'stationDefaultFadeOut', array(
            'class' => 'input_text',
            'label' => _('Default Fade Out (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                $rangeValidator,
                $notEmptyValidator,
                array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => $defaultFadeOut,
        ));


        $podcast_album_override = new Zend_Form_Element_Radio('podcastAlbumOverride');
        $podcast_album_override->setLabel(_('Podcast Album Override'));
        $podcast_album_override->setDescription(_('Always replace downloaded podcast track album with podcast name.'));
        $podcast_album_override->setMultiOptions(array(
            _("Disabled"),
            _("Enabled"),
        ));
        $podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride());
        $podcast_album_override->setDescription(_('Enabling this means that podcast tracks will always contain the podcast name in their album field.'));
        $podcast_album_override->setSeparator(' '); //No <br> between radio buttons
        //$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list')));
        $podcast_album_override->addDecorator('HtmlTag', array('tag' => 'dd',<commit_msg>Remove redundant call to setDescription<commit_after><?php

// this is not getting loaded by autloading since it has a classname
// that makes it clash with how zf1 expects to load plugins.
require_once 'customfilters/ImageSize.php';

class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{

    public function init()
    {
        $maxLens = Application_Model_Show::getMaxLengths();
        $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);

        $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'))
        ));

        $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
        $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();

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

        // Station description
        $stationDescription = new Zend_Form_Element_Textarea("stationDescription");
        $stationDescription->setLabel(_('Station Description'));
        $stationDescription->setValue(Application_Model_Preference::GetStationDescription());
        $stationDescription->setRequired(false);
        $stationDescription->setValidators(array(array('StringLength', false, array(0, $maxLens['description']))));
        $stationDescription->setAttrib('rows', 4);
        $this->addElement($stationDescription);

        // Station Logo
        $stationLogoUpload = new Zend_Form_Element_File('stationLogo');
        $stationLogoUpload->setLabel(_('Station Logo:'))
            ->setDescription(_("Note: Anything larger than 600x600 will be resized."))
            ->setRequired(false)
            ->addValidator('Count', false, 1)
            ->addValidator('Extension', false, 'jpg,jpeg,png,gif')
            ->setMaxFileSize(1000000)
            ->addFilter('ImageSize');
        $stationLogoUpload->setAttrib('accept', 'image/*');
        $this->addElement($stationLogoUpload);

        $stationLogoRemove = new Zend_Form_Element_Button('stationLogoRemove');
        $stationLogoRemove->setLabel(_('Remove'));
        $stationLogoRemove->setAttrib('class', 'btn');
        $stationLogoRemove->setAttrib('id', 'logo-remove-btn');
        $stationLogoRemove->setAttrib('onclick', 'removeLogo();');
        $this->addElement($stationLogoRemove);

        //Default station crossfade duration
        $this->addElement('text', 'stationDefaultCrossfadeDuration', array(
            'class' => 'input_text',
            'label' => _('Default Crossfade Duration (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                    $rangeValidator,
                    $notEmptyValidator,
                    array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(),
        ));

        //Default station fade in
        $this->addElement('text', 'stationDefaultFadeIn', array(
            'class' => 'input_text',
            'label' => _('Default Fade In (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                $rangeValidator,
                $notEmptyValidator,
                array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => $defaultFadeIn,
        ));

        //Default station fade out
        $this->addElement('text', 'stationDefaultFadeOut', array(
            'class' => 'input_text',
            'label' => _('Default Fade Out (s):'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                $rangeValidator,
                $notEmptyValidator,
                array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
            ),
            'value' => $defaultFadeOut,
        ));


        $podcast_album_override = new Zend_Form_Element_Radio('podcastAlbumOverride');
        $podcast_album_override->setLabel(_('Podcast Album Override'));
        $podcast_album_override->setMultiOptions(array(
            _("Disabled"),
            _("Enabled"),
        ));
        $podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride());
        $podcast_album_override->setDescription(_('Enabling this means that podcast tracks will always contain the podcast name in their album field.'));
        $podcast_album_override->setSeparator(' '); //No <br> between radio buttons
        //$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list')));
        $podcast_album_override->addDecorator('HtmlTag', array('tag' => 'dd',
{'fraction_non_alphanumeric': 0.1468408375023161, 'fraction_numerical': 0.006114508060033352, 'mean_word_length': 2.8416370106761564, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 132, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7054090', 'n_tokens_mistral': 2987, 'n_tokens_neox': 2866, 'n_words': 546}