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/form/class.field.wysiwyg.php
<?php

/**
 * This file contains the iwp_field_wysiwyg class
 *
 * @version $Id$
 * 
 *
 * @package IWP
 * @subpackage IWP_FormFields
 */

/**
 * WYSWIYG Field Class
 * This class is used by the api form class to generate a wysiwyg field using DevEdit
 *
 * @package IWP
 * @subpackage IWP_FormFields
 */

class iwp_field_wysiwyg extends iwp_field {
	/**
	 * This is the form field type of the field
	 *
	 * @var string
	 */
	public $type = 'wysiwyg';

	protected $showLabel = false;
	protected $showHelpTip = false;

	/**
	 * This is required for the image uploading in the image browser to work.
	 */
	public $RequiredJs = array('../javascript/jquery/plugins/ajax.file.upload.js');

	/**
	 * __construct
	 * The constructor which calls the parent constructor that sets up the field name if it is passed in during the initialization
	 *
	 * @var string
	 */
	function __construct($name=null){
		parent::__construct($name);

		$this->editor = new tiny_mce();
	}

	public $editor;

	/**
	 * GetFieldOutput
	 * Returns the HTML for this field. It generates the relevant parts, assigns them to template variables and returns a parse template file.
	 *
	 * @return string Returns the field HTML
	 */
	function GetFieldOutput($setOnly=false){
		$inputField = $this->Prepend;
		$this->template->Assign('showLabel', false);

		$pluginHookCode = '';
		iwp_event::trigger(new iwp_event_admin_content_tinymceplugin($pluginHookCode));
		$this->template->Assign(array('tinyMCE', 'pluginHook'), $pluginHookCode);

		$this->editor->readonly = !!$this->GetAttribute('readonly');

		$inputField .= '<textarea class="Field400" style="';

		if ($this->template->Get('tinyMCE', 'width') > 0) {
			$inputField .= 'width: '. $this->template->Get('tinyMCE', 'width') . "px;";
		}

		if ($this->template->Get('tinyMCE', 'height') > 0) {
			$inputField .= 'height: '. $this->template->Get('tinyMCE', 'height') . "px;";
		}

		$inputField .= '" rows="8" id="'. iwp_htmlspecialchars($this->FieldName) .'" name="'. iwp_htmlspecialchars($this->FieldName) .'">';
		$inputField .= $this->valid->HtmlChars($this->FieldValue);
		$inputField .= '</textarea>';
		$inputField .= '<script type="text/javascript">//<!--'."\n".'RegisterCallback("beforePost", function() { $("#' . $this->FieldName . '").val(tinyMCE.get("' . $this->FieldName . '").getContent()); });'."\n".'//--></script>';
		$inputField .= $this->editor->GetEditorHTML($this->FieldName);
		$inputField .= $this->Append;

		$this->template->Assign('inputField', $inputField);
		$this->template->Assign('FieldName', $this->FieldName);



		parent::GetFieldOutput();

		if(!$setOnly){
			return $this->template->ParseTemplate('form.field', true);
		}
		return '';
	}

	/**
	 * Validate
	 * This is the function that data for this field is passed to to ensure it was submitted properly.
	 *
	 * @return string|boolean If the data is not valid, it will return false, if it is valid it will return a value
	 */
	function Validate($arrData){
		return $arrData[$this->FieldName];
	}

}