<commit_before><?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: form_buttons.php
| Author: <NAME> (Chan)
| Co-Author: <NAME>
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

function form_button($input_name, $title, $input_value, array $options = array()) {
    $html = "";

    $input_value = stripinput($input_value);

    $default_options = array(
        'input_id' => $input_name,
        'input_value' => $input_name,
        'class' => "btn-default",
        'icon' => "",
        'deactivate' => FALSE,
        'type' => "submit",
        'block' => FALSE,
        'alt' => $title,
        'data' => [],
        'block' => FALSE,
    );

    $options += $default_options;

    if ($options['block']) {
        $options['class'] = $options['class']." btn-block";
    }

    if ($options['type'] == 'link') {
        $html .= "<a id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' href='".$input_name."' data-value='".$input_value."' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</a>";
    } elseif ($options['type'] == 'button') {
        $html .= "<button id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' name='".$input_name."' value='".$input_value."' type='button' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</button>";
    } else {
        $html .= "<button id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' name='".$input_name."' value='".$input_value."' type='submit' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</button>";
    }

    return $html;
}

/**
 * Button Groups
 * @param        $input_name
 * @param string $label
 * @param        $input_value
 * @param array  $options
 * @return string
 */
function form_btngroup($input_name, $label = "", $input_value, array $options = array()) {
    $locale = fusion_get_locale();<commit_msg>duplicate block<commit_after><?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: form_buttons.php
| Author: <NAME> (Chan)
| Co-Author: <NAME>
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

function form_button($input_name, $title, $input_value, array $options = array()) {
    $html = "";

    $input_value = stripinput($input_value);

    $default_options = array(
        'input_id' => $input_name,
        'input_value' => $input_name,
        'class' => "btn-default",
        'icon' => "",
        'deactivate' => FALSE,
        'type' => "submit",
        'block' => FALSE,
        'alt' => $title,
        'data' => [],
    );

    $options += $default_options;

    if ($options['block']) {
        $options['class'] = $options['class']." btn-block";
    }

    if ($options['type'] == 'link') {
        $html .= "<a id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' href='".$input_name."' data-value='".$input_value."' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</a>";
    } elseif ($options['type'] == 'button') {
        $html .= "<button id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' name='".$input_name."' value='".$input_value."' type='button' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</button>";
    } else {
        $html .= "<button id='".$options['input_id']."' title='".$options['alt']."' class='".($options['deactivate'] ? 'disabled' : '')." btn ".$options['class']." button' name='".$input_name."' value='".$input_value."' type='submit' ".($options['deactivate'] ? "disabled='disabled'" : '')." >".($options['icon'] ? "<i class='".$options['icon']."'></i>" : '')." ".$title."</button>";
    }

    return $html;
}

/**
 * Button Groups
 * @param        $input_name
 * @param string $label
 * @param        $input_value
 * @param array  $options
 * @return string
 */
function form_btngroup($input_name, $label = "", $input_value, array $options = array()) {
    $locale = fusion_get_locale();
{'fraction_non_alphanumeric': 0.3062925170068027, 'fraction_numerical': 0.0, 'mean_word_length': 2.7057340894770006, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 50, 'https://': 2, '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': '402585', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1740, 'n_words': 382}