<commit_before><?php

class ViewHelperJui extends ViewHelper
{
	public function __construct(View $view)  {
		parent::__construct($view);
		$this->view->jQuery()->enableUi();
	}

	public function button($label, array $attrs=array()) {
		$this->setupButton($attrs, 'button');
		return $this->view->html()->button($label, $attrs);
	}

	public function buttonTo($url, $label, array $attrs=array()) {
		$this->setupButton($attrs, 'button');
		return $this->view->html()->buttonTo($url, $label, $attrs);
	}

	public function submitButton($label, array $attrs=array()) {
		$this->setupButton($attrs, 'submit');
		return $this->view->html()->button($label, $attrs);
	}

	public function resetButton($label, array $attrs=array()) {
		$this->setupButton($attrs, 'reset');
		return $this->view->html()->button($label, $attrs);
	}

	public function ajaxButton($url, $label, array $options=array(), array $attrs=array()) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->html()->event($attrs['id'], 'click', $this->view->ajax(array_merge($options, array(
			'url' => $this->view->url($url)
		))));
		return $this->button($label, $attrs);
	}

	public function popupButton($url, $label, array $options=array(), array $attrs=array()) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->html()->event($attrs['id'], 'click', $this->view->popup($url, $options));
		return $this->button($label, $attrs);
	}

	protected function setupButton(&$attrs, $type) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->jQuery()->addCallById($attrs['id'], 'button', array(array(
			'disabled' => (@$attrs['disabled'] === true),
			'icons' => array(
				'primary' => Util::consumeArray($attrs, 'primaryIcon'),
				'secondary' => Util::consumeArray($attrs, 'secondaryIcon')
			)
		)));
		$attrs['type'] = $type;
	}
}<commit_msg>Support for text=false on jQuery UI buttons<commit_after><?php

class ViewHelperJui extends ViewHelper
{
	public function __construct(View $view)  {
		parent::__construct($view);
		$this->view->jQuery()->enableUi();
	}

	public function button($label, array $attrs=array()) {
		$this->setupButton($attrs, 'button');
		return $this->view->html()->button($label, $attrs);
	}

	public function buttonTo($url, $label, array $attrs=array()) {
		$this->setupButton($attrs, 'button');
		return $this->view->html()->buttonTo($url, $label, $attrs);
	}

	public function submitButton($label, array $attrs=array()) {
		$this->setupButton($attrs, 'submit');
		return $this->view->html()->button($label, $attrs);
	}

	public function resetButton($label, array $attrs=array()) {
		$this->setupButton($attrs, 'reset');
		return $this->view->html()->button($label, $attrs);
	}

	public function ajaxButton($url, $label, array $options=array(), array $attrs=array()) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->html()->event($attrs['id'], 'click', $this->view->ajax(array_merge($options, array(
			'url' => $this->view->url($url)
		))));
		return $this->button($label, $attrs);
	}

	public function popupButton($url, $label, array $options=array(), array $attrs=array()) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->html()->event($attrs['id'], 'click', $this->view->popup($url, $options));
		return $this->button($label, $attrs);
	}

	protected function setupButton(&$attrs, $type) {
		$this->defineId($attrs, 'JuiButton');
		$this->view->jQuery()->addCallById($attrs['id'], 'button', array(array(
			'disabled' => (@$attrs['disabled'] === true),
			'text' => (@$attrs['text'] !== false),
			'icons' => array(
				'primary' => Util::consumeArray($attrs, 'primaryIcon'),
				'secondary' => Util::consumeArray($attrs, 'secondaryIcon')
			)
		)));
		$attrs['type'] = $type;
	}
}
{'fraction_non_alphanumeric': 0.23253925284244722, 'fraction_numerical': 0.0, 'mean_word_length': 5.804788213627993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 92, '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': '6421791', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1206, 'n_words': 231}