<commit_before><?php
/**
 * BootNavbar class file.
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright &copy; <NAME> 2011-
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 */

Yii::import('bootstrap.widgets.BootWidget');

/**
 * Bootstrap navigation bar widget.
 * @since 0.9.7
 * @todo Add collapse support. http://twitter.github.com/bootstrap/javascript.html#collapse
 */
class BootNavbar extends BootWidget
{
	/**
	 * @var string the text for the brand.
	 */
	public $brand;
	/**
	 * @var string the URL for the brand link.
	 */
	public $brandUrl;
	/**
	 * @var array the HTML attributes for the brand link.
	 */
	public $brandOptions = array();
	/**
	 * @var array navigation items.
	 * @since 0.9.8
	 */
	public $items = array();
	/**
	 * @var boolean flag that indicates if the nav should use the full width available. Defaults to false.
	 * @since 0.9.8
	 */
	public $fluid = false;
	/**
	 * @var boolean flag that indicates if the nav bar should be fixed to the top of the page. Defaults to true.
	 * @since 0.9.8
	 */
	public $fixed = true;

	/**
	 * Initializes the widget.
	 */
	public function init()
	{
		if ($this->brand !== false)
		{
			$this->brand = CHtml::encode(Yii::app()->name);

			if (!isset($this->brandUrl))
				$this->brandUrl = Yii::app()->homeUrl;
		}
	}

	/**
	 * Runs the widget.
	 */
	public function run()
	{
		if (isset($this->htmlOptions['class']))
			$this->htmlOptions['class'] .= ' navbar';
		else
			$this->htmlOptions['class'] = 'navbar';

		if ($this->fixed)
			$this->htmlOptions['class'] .= ' navbar-fixed-top';
		else
			$this->htmlOptions['class'] .= ' navbar-static';

		if (isset($this->brandOptions['class']))
			$this->brandOptions['class'] .= ' brand';
		else
			$this->brandOptions['class'] = 'brand';

		if (isset($this->brandUrl))
			$this->brandOptions['href'] = $this->brandUrl;

		$containerCssClass = $this->fluid ? 'container-fluid' : 'container';

		echo CHtml::openTag('div', $this->htmlOptions);
		echo '<div class="navbar-inner"><div class="'.$containerCssClass.'">';
		echo '<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"></a>';

        if ($this->brand)
            echo CHtml::openTag('a', $this->brandOptions).$this->brand.'</a>';
        
		echo '<div class="nav-collapse">';

		foreach ($this->items as $item)
		{
			if (is_string($item))
				echo $item;
			else
			{
				if (!isset($item['class']))
					$item['class'] = 'bootstrap.widgets.BootMenu';

				$className = $item['class'];
				unset($item['class']);

				$this->controller->widget($className, $item);
			}
		}

		echo '</div></div></div></div>';
	}
}<commit_msg>Fixes a minor issue with BootNavbar.<commit_after><?php
/**
 * BootNavbar class file.
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright &copy; <NAME> 2011-
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 */

Yii::import('bootstrap.widgets.BootWidget');

/**
 * Bootstrap navigation bar widget.
 * @since 0.9.7
 * @todo Add collapse support. http://twitter.github.com/bootstrap/javascript.html#collapse
 */
class BootNavbar extends BootWidget
{
	/**
	 * @var string the text for the brand.
	 */
	public $brand;
	/**
	 * @var string the URL for the brand link.
	 */
	public $brandUrl;
	/**
	 * @var array the HTML attributes for the brand link.
	 */
	public $brandOptions = array();
	/**
	 * @var array navigation items.
	 * @since 0.9.8
	 */
	public $items = array();
	/**
	 * @var boolean whether the nav span over the full width. Defaults to false.
	 * @since 0.9.8
	 */
	public $fluid = false;
	/**
	 * @var boolean whether the nav bar is fixed to the top of the page. Defaults to true.
	 * @since 0.9.8
	 */
	public $fixed = true;

	/**
	 * Initializes the widget.
	 */
	public function init()
	{
		if (!$this->brand)
		{
			$this->brand = CHtml::encode(Yii::app()->name);

			if (!isset($this->brandUrl))
				$this->brandUrl = Yii::app()->homeUrl;
		}
	}

	/**
	 * Runs the widget.
	 */
	public function run()
	{
		if (isset($this->htmlOptions['class']))
			$this->htmlOptions['class'] .= ' navbar';
		else
			$this->htmlOptions['class'] = 'navbar';

		if ($this->fixed)
			$this->htmlOptions['class'] .= ' navbar-fixed-top';
		else
			$this->htmlOptions['class'] .= ' navbar-static';

		if (isset($this->brandOptions['class']))
			$this->brandOptions['class'] .= ' brand';
		else
			$this->brandOptions['class'] = 'brand';

		if (isset($this->brandUrl))
			$this->brandOptions['href'] = $this->brandUrl;

		$containerCssClass = $this->fluid ? 'container-fluid' : 'container';

		echo CHtml::openTag('div', $this->htmlOptions);
		echo '<div class="navbar-inner"><div class="'.$containerCssClass.'">';
		echo '<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"></a>';

        if ($this->brand !== false)
            echo CHtml::openTag('a', $this->brandOptions).$this->brand.'</a>';
        
		echo '<div class="nav-collapse">';

		foreach ($this->items as $item)
		{
			if (is_string($item))
				echo $item;
			else
			{
				if (isset($item['class']))
				{
					$className = $item['class'];
					unset($item['class']);

					$this->controller->widget($className, $item);
				}
			}
		}

		echo '</div></div></div></div>';
	}
}
{'fraction_non_alphanumeric': 0.19630264913283782, 'fraction_numerical': 0.006098723079855155, 'mean_word_length': 3.2770986145069276, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4475685', 'n_tokens_mistral': 1948, 'n_tokens_neox': 1710, 'n_words': 419}