public function getWidgetHtml($name, $maxRequests, $timeWindow)
    {
        list($timeWindowValue, $timeWindowUnit) = $this->splitTimeWindow($timeWindow);
        $html = '<div class="input-group" id="' . $name . '_container">';
        $html .= $this->form->number($name . '_maxRequests', $maxRequests, ['min' => '1']);
        $html .= '<span class="input-group-addon">' . tc('TimeInterval', 'requests every') . '</span>';
        $html .= $this->form->number($name . '_timeWindow_value', $timeWindowValue, ['min' => '1']);
        $html .= '<div class="input-group-btn">';
        $timeWindowUnits = $this->getTimeWindowUnits();
        $u = $this->form->getRequestValue($name . '_timeWindow_unit');
        if (isset($timeWindowUnits[$u])) {
            $timeWindowUnit = $u;
        }
        $html .= '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span id="' . $name . '_timeWindow_unitlabel">' . h($timeWindowUnits[$timeWindowUnit]) . '</span> <span class="caret"></span></button>';
        $html .= '<ul class="dropdown-menu dropdown-menu-right">';
        foreach ($timeWindowUnits as $unitValue => $unitName) {
            $html .= '<li><a href="#" data-unit-value="' . $unitValue . '" data-max-value="' . floor(PHP_INT_MAX / $unitValue) . '">' . h($unitName) . '</a></li>';
        }
        $html .= '</ul>';
        $html .= '</div>';
        $html .= $this->form->hidden($name . '_timeWindow_unit', $timeWindowUnit);
        $html .= '</div>';
        $html .= <<<EOT
<script>
$(document).ready(function() {
    var twValue = $('#{$name}_timeWindow_value'), twUnitLabel = $('#{$name}_timeWindow_unitlabel'), twUnit = $('#{$name}_timeWindow_unit'), twUnitLinks = $('#{$name}_container a[data-unit-value]');
    twUnit
        .on('change', function() {
            var a = twUnitLinks.filter('[data-unit-value="' + twUnit.val() + '"]');
            twUnitLabel.text(a.text());
            twValue.attr('max', a.data('max-value'));
        })
        .trigger('change')
    ;
    twUnitLinks.on('click', function(e) {
        e.preventDefault();
        twUnit.val($(this).data('unit-value')).trigger('change');
    });
});
</script>
EOT
        ;

        return $html;
    }
public function getWidgetHtml($name, $maxRequests, $timeWindow)
    {
        list($timeWindowValue, $timeWindowUnit) = $this->splitTimeWindow($timeWindow);
        $html = '<div class="input-group" id="' . $name . '_container">';
        $html .= $this->form->number($name . '_maxRequests', $maxRequests, ['min' => '1']);
        $html .= '<span class="input-group-addon">' . tc('TimeInterval', 'requests every') . '</span>';
        $html .= $this->form->number($name . '_timeWindow_value', $timeWindowValue, ['min' => '1']);
        $html .= '<div class="input-group-btn">';
        $timeWindowUnits = $this->getTimeWindowUnits();
        $u = $this->form->getRequestValue($name . '_timeWindow_unit');
        if (isset($timeWindowUnits[$u])) {
            $timeWindowUnit = $u;
        }
        $html .= '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span id="' . $name . '_timeWindow_unitlabel">' . h($timeWindowUnits[$timeWindowUnit]) . '</span> <span class="caret"></span></button>';
        $html .= '<ul class="dropdown-menu dropdown-menu-right">';
        foreach ($timeWindowUnits as $unitValue => $unitName) {
            $html .= '<li><a href="#" data-unit-value="' . $unitValue . '" data-max-value="' . floor(PHP_INT_MAX / $unitValue) . '">' . h($unitName) . '</a></li>';
        }
        $html .= '</ul>';
        $html .= '</div>';
        $html .= $this->form->hidden($name . '_timeWindow_unit', $timeWindowUnit);
        $html .= '</div>';
        $html .= <<<EOT
<script>
$(document).ready(function() {
    var twValue = $('#{$name}_timeWindow_value'), twUnitLabel = $('#{$name}_timeWindow_unitlabel'), twUnit = $('#{$name}_timeWindow_unit'), twUnitLinks = $('#{$name}_container a[data-unit-value]');
    twUnit
        .on('change', function() {
            var a = twUnitLinks.filter('[data-unit-value="' + twUnit.val() + '"]');
            twUnitLabel.text(a.text());
            twValue.attr('max', a.data('max-value'));
        })
        .trigger('change')
    ;
    twUnitLinks.on('click', function(e) {
        e.preventDefault();
        twUnit.val($(this).data('unit-value')).trigger('change');
    });
});
</script>
EOT
        ;

        return $html;
    }
public function getWidgetHtml ( $ name , $ maxRequests , $ timeWindow ) { list ( $ timeWindowValue , $ timeWindowUnit ) = $ this -> splitTimeWindow ( $ timeWindow ) ; $ html = '<div class="input-group" id="' . $ name . '_container">' ; $ html .= $ this -> form -> number ( $ name . '_maxRequests' , $ maxRequests , [ 'min' => '1' ] ) ; $ html .= '<span class="input-group-addon">' . tc ( 'TimeInterval' , 'requests every' ) . '</span>' ; $ html .= $ this -> form -> number ( $ name . '_timeWindow_value' , $ timeWindowValue , [ 'min' => '1' ] ) ; $ html .= '<div class="input-group-btn">' ; $ timeWindowUnits = $ this -> getTimeWindowUnits ( ) ; $ u = $ this -> form -> getRequestValue ( $ name . '_timeWindow_unit' ) ; if ( isset ( $ timeWindowUnits [ $ u ] ) ) { $ timeWindowUnit = $ u ; } $ html .= '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span id="' . $ name . '_timeWindow_unitlabel">' . h ( $ timeWindowUnits [ $ timeWindowUnit ] ) . '</span> <span class="caret"></span></button>' ; $ html .= '<ul class="dropdown-menu dropdown-menu-right">' ; foreach ( $ timeWindowUnits as $ unitValue => $ unitName ) { $ html .= '<li><a href="#" data-unit-value="' . $ unitValue . '" data-max-value="' . floor ( PHP_INT_MAX / $ unitValue ) . '">' . h ( $ unitName ) . '</a></li>' ; } $ html .= '</ul>' ; $ html .= '</div>' ; $ html .= $ this -> form -> hidden ( $ name . '_timeWindow_unit' , $ timeWindowUnit ) ; $ html .= '</div>' ; $ html .=  <<<EOT
<script>
$(document).ready(function() {
    var twValue = $('#{$name}_timeWindow_value'), twUnitLabel = $('#{$name}_timeWindow_unitlabel'), twUnit = $('#{$name}_timeWindow_unit'), twUnitLinks = $('#{$name}_container a[data-unit-value]');
    twUnit
        .on('change', function() {
            var a = twUnitLinks.filter('[data-unit-value="' + twUnit.val() + '"]');
            twUnitLabel.text(a.text());
            twValue.attr('max', a.data('max-value'));
        })
        .trigger('change')
    ;
    twUnitLinks.on('click', function(e) {
        e.preventDefault();
        twUnit.val($(this).data('unit-value')).trigger('change');
    });
});
</script>
EOT ; return $ html ; }
Create the HTML for a rate limit.

@param string $name
@param int|null $maxRequests
@param int $timeWindow

@return string
Create the HTML for a rate limit .