HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/api/class.output.php
<?php
/**
* This file contains the iwp_output class
*
* @package IWP
* @subpackage IWP_API
*/

/**
* IWP Output class
*
* This class contains various methods for formatting data into common HTML elements.
*
* @package IWP
* @subpackage IWP_API
*/
class iwp_output extends iwp_base {
	/**
	 * Instance
	 * This static variable holds the current instance of this object being loaded.
	 * So using the getInstance function anywhere will return the very same instance.
	 *
	 * @var iwp_output Instance
	 */
	public static $Instance;

	/**
	 * getInstance
	 * This is a static function that sets up the class instance and stores it to the static variable. It will then return that instantiation in the future.
	 *
	 * @return iwp_output Returns the instantiated object
	 **/
	public static function getInstance(){
		if(!isset(self::$Instance)){
			self::$Instance = new self();
		}
		return self::$Instance;
	}

	public function Script($script){
		return '<script type="text/javascript">' . "\n" . $script . "\n" . "</script>";
	}
	public function ScriptOnReady($script){
		return '<script type="text/javascript">' . "\n" . '$(document).ready(function() {'. "\n" . $script . "\n" . '});' . "\n" . "</script>";
	}

	public function RedirectPage($url){
		return '<html><head><meta http-equiv="refresh" content="1;url='.$url.'"><script>window.location = "'.$url.'";</script></head></html>';
	}

	public function HTMLComment($comment){
		return '<!-- '.str_replace('-->', ' - - >', $comment) .' -->';
	}

	public function ArrayToJSArray($arrList){
		if(!is_array($arrList)){
			return '';
		}

		$arrList = str_replace("'", "\'", $arrList);

		return "['" . implode("','", $arrList) . "']";
	}

	public function Checked(){
		return 'checked="checked"';
	}

	public function Selected(){
		return 'selected="selected"';
	}

	public function LinkTag($url, $content, $newWindow=false){
		$target = '';
		if($newWindow){
			$target = " target='_blank'";
		}
		return "<a href='". iwp_htmlentities($url) ."'". $target .">".$content."</a>";
	}

	public function ArrayToOptions($array, $selected=null){
		if($selected === null){
			$selected = array();
		}
		$options = '';
		if(is_array($array)){
			foreach($array as $key=>$value){
				$options .= "<option value='".$key."'";
				if(is_array($selected) && sizeof($selected) > 0){
					if(in_array($key, $selected)){
						$options .= " selected";
					}
				}
				$options .= ">".$value."</option>";
			}
		}
		return $options;
	}

	public function Option($value, $text, $selected=false) {
		$return = '<option value="' . $value .'"';

		if($selected) {
			$return .= ' selected="selected"';
		}

		$return .= '>' . $text .'</option>';

		return $return;
	}

	public function OptGroup($label, $subOptions='') {
		return '<optgroup label="' . $label .'">' . $subOptions .'</optgroup>';
	}

	public function ArrayToList($arrList, $type='ul', $noHtmlChars=false){
		if($type !== 'ul' && $type !== 'ol' && $type!==false){
			$type = 'ul';
		}

		$output = '';

		if(!is_array($arrList)){
			if(strlen($arrList) < 1){
				return '';
			}else{
				$arrList = (array)$arrList;
			}
		}

		if($type !== false){
			$output = '<'.$type.'>';
		}

		foreach($arrList as $_key=>$value) {
			if($noHtmlChars){
				$output .= "<li>".$value."</li>";
			}else{
				$output .= "<li>".htmlspecialchars($value, ENT_QUOTES, iwp_config::Get('charset'))."</li>";
			}
		}

		if($type !== false){
			$output .= '</'.$type.'>';
		}

		return $output;
	}
}