<commit_before><?php

/**
 * sfShop, open source e-commerce solutions.
 * (c) 2008 <NAME> <<EMAIL>>
 * 
 * Released under the MIT License.
 * 
 * For the full copyright and license information, please view the LICENSE file.
 */

/**
 * InformationI18n form.
 *
 * @package    plugin.sfsCorePlugin
 * @subpackage lib.form
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class InformationI18nForm extends BaseInformationI18nForm
{
    public function configure()
    {
        $this->setWidgets(array(
          'id'               => new sfWidgetFormInputHidden(),
          'culture'          => new sfWidgetFormInputHidden(),
          'title'            => new sfWidgetFormInput(array(), array('size' => 80)),
          'description'      => new sfWidgetFormTextarea(
              array(),
              array(
                  'cols'  => 110,
                  'rows'  => 20,
                  'class' => 'mce-editor'
              )),
          'meta_keywords'    => new sfWidgetFormTextarea(array(), array('cols' => 80, 'rows' => 2)),
          'meta_description' => new sfWidgetFormTextarea(array(), array('cols' => 80, 'rows' => 5)),
        ));
        
        $idValidator = new sfValidatorPropelChoice(
            array('model' => 'Information', 'column' => 'id', 'required' => false)
        );
        
        $cultureValidator = new sfValidatorPropelChoice(
            array('model' => 'InformationI18n', 'column' => 'culture', 'required' => false)
        );
        
        $titleValidator = new sfValidatorString(
            array(
                'required'   => true,
                'max_length' => 255
            ),
            array(
                'required'   => 'Title is a required field',
                'max_length' => 'Title can not be more 255 characters'
            )
        );
        
        $descriptionValidator = new sfValidatorString(
            array('required' => true),
            array('required' => 'Description is a required field')
        );
        
        $this->setValidators(array(
            'id'               => $idValidator,
            'culture'          => $cultureValidator,
            'title'            => $titleValidator,
            'description'      => $descriptionValidator,
            'meta_keywords'    => new sfValidatorString(array('required' => false)),
            'meta_description' => new sfValidatorString(array('required' => false)),
        ));
        
        $this->getWidgetSchema()->setNameFormat('information_i18n[%s]');
    }
}
<commit_msg>optimezed a class InformationI18nForm<commit_after><?php

/**
 * sfShop, open source e-commerce solutions.
 * (c) 2008 <NAME> <<EMAIL>>
 * 
 * Released under the MIT License.
 * 
 * For the full copyright and license information, please view the LICENSE file.
 */

/**
 * InformationI18n form.
 *
 * @package    plugin.sfsCorePlugin
 * @subpackage lib.form
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class InformationI18nForm extends BaseInformationI18nForm
{
    public function configure()
    {
        parent::configure();
        
        $widgetDescription = new sfWidgetFormTextarea(
            array(),
            array(
              'cols'  => 110,
              'rows'  => 20,
              'class' => 'mce-editor'
            )
        );
        
        $metaKeywordsWidget = new sfWidgetFormTextarea(
            array(),
            array('cols' => 80, 'rows' => 2)
        );
        
        $metaDescriptionWidget = new sfWidgetFormTextarea(
            array(),
            array('cols' => 80, 'rows' => 5)
        );
        
        $this->setWidget('title', new sfWidgetFormInput(array(), array('size' => 80)));
        $this->setWidget('description', $widgetDescription);
        $this->setWidget('meta_keywords', $metaKeywordsWidget);
        $this->setWidget('meta_description', $metaDescriptionWidget);
        
        $titleValidator = new sfValidatorString(
            array(
                'required'   => true,
                'max_length' => 255
            ),
            array(
                'required'   => 'Title is a required field',
                'max_length' => 'Title can not be more 255 characters'
            )
        );
        
        $descriptionValidator = new sfValidatorString(
            array('required' => true),
            array('required' => 'Description is a required field')
        );
        
        $this->setValidator('title', $titleValidator);
        $this->setValidator('description', $descriptionValidator);
    }
}

{'fraction_non_alphanumeric': 0.13108454312553372, 'fraction_numerical': 0.02134927412467976, 'mean_word_length': 1.875997544505832, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 73, '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': '1088836', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1246, 'n_words': 289}