<commit_before><?php

/**
 * Wrapper for bootstrap-timepicker,
 * https://github.com/tarruda/bootstrap-datetimepicker/
 * http://tarruda.github.io/bootstrap-datetimepicker/
 */
class DateTimePicker extends CInputWidget
{
    /**
     * @var array
     */
    public $options = array();

    /**
     * http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScriptFile-detail
     * @var integer Script position
     */
    public $scriptPosition = null;

    /**
     * @var string Html element selector
     */
    public $selector;

    public static function initClientScript($scriptPosition = null)
    {
        $ds = DIRECTORY_SEPARATOR;
        //assets/js/
        //assets/css/
        $bu = Yii::app()->assetManager->publish(__DIR__ . "{$ds}assets");
        $cs = Yii::app()->clientScript;
        if ($scriptPosition === null)
            $scriptPosition = $cs->coreScriptPosition;
        //bootstrap-datetimepicker.min.js
        //bootstrap-datetimepicker.js
        //locales/bootstrap-datetimepicker.ru.js
        //bootstrap-datetimepicker.min.css
        $cs->registerScriptFile($bu . "{$ds}js{$ds}bootstrap-datetimepicker" . (YII_DEBUG ? '' : '.min') . '.js', $scriptPosition);
        //approximate
        //$cs->registerScriptFile($bu . "{$ds}js{$ds}locales{$ds}bootstrap-datetimepicker." . (Yii::app()->language) . '.js', $scriptPosition);
        $cs->registerCssFile($bu . "{$ds}css{$ds}bootstrap-datetimepicker" . '.min' . '.css');
    }

    public function run()
    {
        if ($this->selector === null) {
            list($this->name, $this->id) = $this->resolveNameId();
            $this->selector = '#' . $this->id;
        }

        if (!isset($this->htmlOptions['value'])) {
            if ($this->hasModel()) {
                $this->value = CHtml::resolveValue($this->model, $this->attribute);
            }
        } else {
            $this->value = $this->htmlOptions['value'];
            unset($this->htmlOptions['value']);
        }

        $this->htmlOptions['autocomplete'] = 'off';

        self::initClientScript($this->scriptPosition);
        $options = $this->options !== null ? CJavaScript::encode($this->options) : '';
        Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->id,
            "jQuery('{$this->selector}').datetimepicker({$options})"
        );

        echo '<div class="input-append bootstrap-datetimepicker-widget">' .
            CHtml::textField($this->name, $this->value, $this->htmlOptions) .
            '<span class="add-on">
            <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
            </span></div>';
    }
}<commit_msg>some fix<commit_after><?php

/**
 * Wrapper for bootstrap-timepicker,
 * https://github.com/tarruda/bootstrap-datetimepicker/
 * http://tarruda.github.io/bootstrap-datetimepicker/
 */
class DateTimePicker extends CInputWidget
{
    /**
     * @var array
     */
    public $options = [];

    /**
     * http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScriptFile-detail
     * @var integer Script position
     */
    public $scriptPosition = null;

    /**
     * @var string Html element selector
     */
    public $selector;

    public static function initClientScript($scriptPosition = null)
    {
        $ds = DIRECTORY_SEPARATOR;
        //assets/js/
        //assets/css/
        $bu = Yii::app()->assetManager->publish(__DIR__ . "{$ds}assets");
        $cs = Yii::app()->clientScript;
        if ($scriptPosition === null)
            $scriptPosition = $cs->coreScriptPosition;
        //bootstrap-datetimepicker.min.js
        //bootstrap-datetimepicker.js
        //locales/bootstrap-datetimepicker.ru.js
        //bootstrap-datetimepicker.min.css
        $cs->registerScriptFile($bu . "{$ds}js{$ds}bootstrap-datetimepicker" . (YII_DEBUG ? '' : '.min') . '.js', $scriptPosition);
        //approximate
        $cs->registerScriptFile($bu . "{$ds}js{$ds}locales{$ds}bootstrap-datetimepicker." . (Yii::app()->getLanguage()) . '.js', $scriptPosition);
        $cs->registerCssFile($bu . "{$ds}css{$ds}bootstrap-datetimepicker" . '.min' . '.css');
    }

    public function run()
    {
        if ($this->selector === null) {
            list($this->name, $this->id) = $this->resolveNameId();
            $this->selector = '#' . $this->id;
        }

        if (!isset($this->htmlOptions['value'])) {
            if ($this->hasModel()) {
                $this->value = CHtml::resolveValue($this->model, $this->attribute);
            }
        } else {
            $this->value = $this->htmlOptions['value'];
            unset($this->htmlOptions['value']);
        }

        if (!isset($this->htmlOptions['data-format']))
            $this->htmlOptions['data-format']="dd/MM/yyyy hh:mm:ss";

        $this->htmlOptions['autocomplete'] = 'off';

        self::initClientScript($this->scriptPosition);
        $options = $this->options !== null ? CJavaScript::encode($this->options) : '';
        Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->id,
            "jQuery('{$this->selector}_h').datetimepicker({$options})"
        );

        echo '<div class="input-append" id="'.$this->id.'_h">' .
            CHtml::textField($this->name, $this->value, $this->htmlOptions) .
            '<span class="add-on">
            <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time">
            </i></span></div>';
    }
}
{'fraction_non_alphanumeric': 0.1883152673158185, 'fraction_numerical': 0.0007348888480617307, 'mean_word_length': 2.441213653603034, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 84, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2835283', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1599, 'n_words': 233}