<commit_before><?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * textarea_counter.php
 *
 * @category  Admin
 * @package   admin
 * @author    <NAME> <<EMAIL>>
 * @version   $Id$
 */


/**
 * @category Admin
 * @package  admin
 */
class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {

    /**
     * html for help button, if empty then no help
     *
     * @var string
     */
    var $_helpbutton='';
    
    var $_https=false;

    /**
     * <code>
     * $form->addElement('textarea_counter', 'message', 'Message',
     *   array('cols'=>60, 'rows'=>10), 160);
     * </code>
     */
    function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) {
        parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
        $this->_type = 'recaptcha';
        if (!empty($attributes['https'])) {
            $this->_https = $attributes['https'];
        }
    }

    /**
     * Returns the recaptcha element in HTML
     *
     * @since     1.0
     * @access    public
     * @return    string
     */
    function toHtml() {
        global $CFG, $PAGE;
        require_once $CFG->libdir . '/recaptchalib.php';

        $recaptureoptions = Array('theme'=>'custom', 'tabindex'=>2, 'custom_theme_widget'=>'recaptcha_widget');
        $html = $PAGE->requires->data_for_js('RecaptchaOptions', $recaptureoptions)->asap();

        $attributes = $this->getAttributes();
        if (empty($attributes['error_message'])) {
            $attributes['error_message'] = null;
            $this->setAttributes($attributes);
        }
        $error = $attributes['error_message'];
        unset($attributes['error_message']);
        
        $strincorrectpleasetryagain = get_string('incorrectpleasetryagain', 'auth');
        $strenterthewordsabove = get_string('enterthewordsabove', 'auth');
        $strenterthenumbersyouhear = get_string('enterthenumbersyouhear', 'auth');
        $strgetanothercaptcha = get_string('getanothercaptcha', 'auth');
        $strgetanaudiocaptcha = get_string('getanaudiocaptcha', 'auth');
        $strgetanimagecaptcha = get_string('getanimagecaptcha', 'auth');

        $html .= '
<div id="recaptcha_widget" style="display:none">

<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">' . $strincorrectpleasetryagain . '</div>

<span class="recaptcha_only_if_image"><label for="recaptcha_response_field">' . $strenterthewordsabove . '</label></span>
<span class="recaptcha_only_if_audio"><label for="recaptcha_response_field">' . $strenterthenumbersyouhear . '</label></span>

<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
<input type="hidden" name="recaptcha_element" value="dummyvalue" /> <!-- Dummy value to fool formslib -->
<div><a href="javascript:Recaptcha.reload()">' . $strgetanothercaptcha . '</a></div><commit_msg>form/recaptcha MDL-20144 Don't specify tabindex, for accessibility<commit_after><?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * textarea_counter.php
 *
 * @category  Admin
 * @package   admin
 * @author    <NAME> <<EMAIL>>
 * @version   $Id$
 */


/**
 * @category Admin
 * @package  admin
 */
class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {

    /**
     * html for help button, if empty then no help
     *
     * @var string
     */
    var $_helpbutton='';
    
    var $_https=false;

    /**
     * <code>
     * $form->addElement('textarea_counter', 'message', 'Message',
     *   array('cols'=>60, 'rows'=>10), 160);
     * </code>
     */
    function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) {
        parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
        $this->_type = 'recaptcha';
        if (!empty($attributes['https'])) {
            $this->_https = $attributes['https'];
        }
    }

    /**
     * Returns the recaptcha element in HTML
     *
     * @since     1.0
     * @access    public
     * @return    string
     */
    function toHtml() {
        global $CFG, $PAGE;
        require_once $CFG->libdir . '/recaptchalib.php';

        $recaptureoptions = Array('theme'=>'custom', 'custom_theme_widget'=>'recaptcha_widget');
        $html = $PAGE->requires->data_for_js('RecaptchaOptions', $recaptureoptions)->asap();

        $attributes = $this->getAttributes();
        if (empty($attributes['error_message'])) {
            $attributes['error_message'] = null;
            $this->setAttributes($attributes);
        }
        $error = $attributes['error_message'];
        unset($attributes['error_message']);
        
        $strincorrectpleasetryagain = get_string('incorrectpleasetryagain', 'auth');
        $strenterthewordsabove = get_string('enterthewordsabove', 'auth');
        $strenterthenumbersyouhear = get_string('enterthenumbersyouhear', 'auth');
        $strgetanothercaptcha = get_string('getanothercaptcha', 'auth');
        $strgetanaudiocaptcha = get_string('getanaudiocaptcha', 'auth');
        $strgetanimagecaptcha = get_string('getanimagecaptcha', 'auth');

        $html .= '
<div id="recaptcha_widget" style="display:none">

<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">' . $strincorrectpleasetryagain . '</div>

<span class="recaptcha_only_if_image"><label for="recaptcha_response_field">' . $strenterthewordsabove . '</label></span>
<span class="recaptcha_only_if_audio"><label for="recaptcha_response_field">' . $strenterthenumbersyouhear . '</label></span>

<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
<input type="hidden" name="recaptcha_element" value="dummyvalue" /> <!-- Dummy value to fool formslib -->
<div><a href="javascript:Recaptcha.reload()">' . $strgetanothercaptcha . '</a></div>
{'fraction_non_alphanumeric': 0.15987088005436628, 'fraction_numerical': 0.0050968399592252805, 'mean_word_length': 3.5848909657320873, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 80, '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': '7211368', 'n_tokens_mistral': 1904, 'n_tokens_neox': 1842, 'n_words': 318}