<commit_before><?php
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Captcha_Questions extends Zend_Captcha_Word
{
	/**
	 * CAPTCHA label
	 * @type string
	 */
	protected $_label = '';

	private $_questions = array();    // array for quesiotns and answers passed to ctor
	private $_current = null;        // int current q & a

	/**
	 * Constructor
	 *
	 * @param  array|$questions
	 */
	public function __construct($questions)
	{
		$this->_questions = $questions;
	}

	/**
	 * Generate new session ID and new word
	 *
	 * @return string session ID
	 */
	public function generate()
	{
		if (!$this->_keepSession) {
			$this->_session = null;
		}
		$id = $this->_generateRandomId();
		$this->_setId($id);
		$word = $this->_generateWord();
		$this->_setWord($word);
		return $id;
	}

	/**
	 * Render the captcha
	 *
	 * @param  Zend_View_Interface $view
	 * @param  mixed $element
	 * @return string
	 */
	public function render(Zend_View_Interface $view = null, $element = null)
	{
		$question = $this->_questions[$this->_current];

		return $question[0];
	}
<commit_msg>[FIX] captcha: Translate question for q&a captchas<commit_after><?php
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Captcha_Questions extends Zend_Captcha_Word
{
	/**
	 * CAPTCHA label
	 * @type string
	 */
	protected $_label = '';

	private $_questions = array();    // array for quesiotns and answers passed to ctor
	private $_current = null;        // int current q & a

	/**
	 * Constructor
	 *
	 * @param  array|$questions
	 */
	public function __construct($questions)
	{
		$this->_questions = $questions;
	}

	/**
	 * Generate new session ID and new word
	 *
	 * @return string session ID
	 */
	public function generate()
	{
		if (!$this->_keepSession) {
			$this->_session = null;
		}
		$id = $this->_generateRandomId();
		$this->_setId($id);
		$word = $this->_generateWord();
		$this->_setWord($word);
		return $id;
	}

	/**
	 * Render the captcha
	 *
	 * @param  Zend_View_Interface $view
	 * @param  mixed $element
	 * @return string
	 */
	public function render(Zend_View_Interface $view = null, $element = null)
	{
		$question = $this->_questions[$this->_current];

		return tra($question[0]);
	}

{'fraction_non_alphanumeric': 0.13368983957219252, 'fraction_numerical': 0.006875477463712758, 'mean_word_length': 3.286415711947627, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '7228120', 'n_tokens_mistral': 915, 'n_tokens_neox': 805, 'n_words': 252}