# contact-forms/trunk/PFBC/Element/TinyMCE.php

Contact Forms by Cimatti, version trunk. 62 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/trunk/code/PFBC/Element/TinyMCE.php
- Raw: https://pluginprobe.com/plugins/contact-forms/trunk/raw/PFBC/Element/TinyMCE.php
- Modified: 2026-04-08T09:49:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/trunk/code/PFBC/Element/TinyMCE.php#L10-L20`.

```php
<?php
/**
 * PFBC (PHP Form Builder Class) - Third-party library
 * @package PFBC
 */
if ( ! defined( 'ABSPATH' ) ) exit;

// phpcs:disable WordPress.Security.EscapeOutput, WordPress.NamingConventions.PrefixAllGlobals, PluginCheck.CodeAnalysis.Heredoc -- Third-party library

class Element_TinyMCE extends Element_Textarea {
	protected $basic;

	public function jQueryDocumentReady() {
		echo 'jQuery("#', $this->attributes["id"], '").width(jQuery("#', $this->attributes["id"], '").width());';
	}

	function renderJS() {
		echo <<<JS
tinyMCE.init({
    mode: "exact",
    elements: "{$this->attributes["id"]}",
JS;
		if(empty($this->basic)) {
			echo <<<JS
    theme: "advanced",
    plugins: "safari,table,paste,inlinepopups,preview,fullscreen",
    dialog_type: "modal",
    theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2: "link,unlink,anchor,image,charmap,hr,|,tablecontrols,|,pastetext,pasteword,|,cleanup,code,preview,fullscreen,|,undo,redo",
    theme_advanced_buttons3: "",
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_resizing : true,
JS;
		}
		else
			echo 'theme: "simple",';
	echo <<<JS
    forced_root_block: false,
    force_br_newlines: true,
    force_p_newlines: false
});	
JS;
	
		$ajax = $this->form->getAjax();
		$id = $this->form->getID();
		if(!empty($ajax)) {
			echo <<<JS
	jQuery("#$id").bind("submit", function() {
		tinyMCE.triggerSave();
	});
JS;
		}
	}

	function getJSFiles() {
		return array(
			$this->form->getResourcesPath() . "/tiny_mce/tiny_mce.js"
		);
	}
}	

```
