PluginProbe
Contact Forms by Cimatti / 2.3.5
Contact Forms by Cimatti v2.3.5
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / PFBC / Element / TinyMCE.php

TinyMCE.php in Contact Forms by Cimatti 2.3.5, at PFBC/Element/TinyMCE.php

62 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PFBC (PHP Form Builder Class) - Third-party library
4 * @package PFBC
5 */
6 if ( ! defined( 'ABSPATH' ) ) exit;
7
8 // phpcs:disable WordPress.Security.EscapeOutput, WordPress.NamingConventions.PrefixAllGlobals, PluginCheck.CodeAnalysis.Heredoc -- Third-party library
9
10 class Element_TinyMCE extends Element_Textarea {
11 protected $basic;
12
13 public function jQueryDocumentReady() {
14 echo 'jQuery("#', $this->attributes["id"], '").width(jQuery("#', $this->attributes["id"], '").width());';
15 }
16
17 function renderJS() {
18 echo <<<JS
19 tinyMCE.init({
20 mode: "exact",
21 elements: "{$this->attributes["id"]}",
22 JS;
23 if(empty($this->basic)) {
24 echo <<<JS
25 theme: "advanced",
26 plugins: "safari,table,paste,inlinepopups,preview,fullscreen",
27 dialog_type: "modal",
28 theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,formatselect,fontselect,fontsizeselect",
29 theme_advanced_buttons2: "link,unlink,anchor,image,charmap,hr,|,tablecontrols,|,pastetext,pasteword,|,cleanup,code,preview,fullscreen,|,undo,redo",
30 theme_advanced_buttons3: "",
31 theme_advanced_toolbar_location: "top",
32 theme_advanced_toolbar_align : "left",
33 theme_advanced_resizing : true,
34 JS;
35 }
36 else
37 echo 'theme: "simple",';
38 echo <<<JS
39 forced_root_block: false,
40 force_br_newlines: true,
41 force_p_newlines: false
42 });
43 JS;
44
45 $ajax = $this->form->getAjax();
46 $id = $this->form->getID();
47 if(!empty($ajax)) {
48 echo <<<JS
49 jQuery("#$id").bind("submit", function() {
50 tinyMCE.triggerSave();
51 });
52 JS;
53 }
54 }
55
56 function getJSFiles() {
57 return array(
58 $this->form->getResourcesPath() . "/tiny_mce/tiny_mce.js"
59 );
60 }
61 }
62