<commit_before><?php
/**
* @package    jelix
* @subpackage jtpl_plugin
* @author     <NAME>
* @contributor <NAME>
* @copyright  2007 <NAME>, 2009 <NAME>
* @link        http://www.jelix.org
* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/

/**
 * function plugin :  print the html content of a form submit button. You can use this plugin inside a formsubmits block
 *
 * @param jTpl $tpl template engine
 * @param string $ctrlname  the name of the submit to display (required if it is outside a formsubmits)
 */
function jtpl_function_html_formsubmit($tpl, $ctrlname='')
{
    if($ctrlname =='') {
        if(isset($tpl->_privateVars['__submitref']) && $tpl->_privateVars['__submitref'] != ''){
            $ctrlname = $tpl->_privateVars['__submitref'];
            $ctrl = $tpl->_privateVars['__submit'];
        }else{
            $ctrls = $tpl->_privateVars['__form']->getSubmits();
            if (count($ctrls) == 0) {
                throw new jException('jelix~formserr.unknown.control',
                array('submit', $tpl->_privateVars['__form']->getSelector(),$tpl->_templateName));
            }
            reset($ctrls);
            $ctrlname = key($ctrls);
            $ctrl = current($ctrls);
        }
    }else{
        $ctrls = $tpl->_privateVars['__form']->getSubmits();
        if (count($ctrls) == 0) {
            throw new jException('jelix~formserr.unknown.control',
            array($ctrlname, $tpl->_privateVars['__form']->getSelector(),$tpl->_templateName));
        }
        $ctrl = $ctrls[$ctrlname];
    }

    if($tpl->_privateVars['__form']->isActivated($ctrlname)) {
        $tpl->_privateVars['__displayed_submits'][$ctrlname] = true;
        $tpl->_privateVars['__formbuilder']->outputControl($ctrl);
    }
}
<commit_msg>Adds possibility to indicates attributes on {jformsubmit}<commit_after><?php
/**
* @package    jelix
* @subpackage jtpl_plugin
* @author     <NAME>
* @contributor <NAME>
* @copyright  2007-2015 <NAME>, 2009 <NAME>
* @link        http://www.jelix.org
* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/

/**
 * function plugin :  print the html content of a form submit button. You can use this plugin inside a formsubmits block
 *
 * @param jTpl $tpl template engine
 * @param string $ctrlname  the name of the submit to display (required if it is outside a formsubmits)
 * @param array $attributes  attributes for the generated html element
 */
function jtpl_function_html_formsubmit($tpl, $ctrlname='', $attributes=array())
{
    if($ctrlname =='') {
        if(isset($tpl->_privateVars['__submitref']) && $tpl->_privateVars['__submitref'] != ''){
            $ctrlname = $tpl->_privateVars['__submitref'];
            $ctrl = $tpl->_privateVars['__submit'];
        }else{
            $ctrls = $tpl->_privateVars['__form']->getSubmits();
            if (count($ctrls) == 0) {
                throw new jException('jelix~formserr.unknown.control',
                array('submit', $tpl->_privateVars['__form']->getSelector(),$tpl->_templateName));
            }
            reset($ctrls);
            $ctrlname = key($ctrls);
            $ctrl = current($ctrls);
        }
    }else{
        $ctrls = $tpl->_privateVars['__form']->getSubmits();
        if (count($ctrls) == 0) {
            throw new jException('jelix~formserr.unknown.control',
            array($ctrlname, $tpl->_privateVars['__form']->getSelector(),$tpl->_templateName));
        }
        $ctrl = $ctrls[$ctrlname];
    }

    if($tpl->_privateVars['__form']->isActivated($ctrlname)) {
        $tpl->_privateVars['__displayed_submits'][$ctrlname] = true;
        $tpl->_privateVars['__formbuilder']->outputControl($ctrl, $attributes);
    }
}

{'fraction_non_alphanumeric': 0.1612137203166227, 'fraction_numerical': 0.0063324538258575196, 'mean_word_length': 2.9989451476793247, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4011750', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1198, 'n_words': 241}