HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/somonline.org/wp-content/plugins/insert-php/libs/factory/forms/controls/wp-editor.php
<?php

	/**
	 * WP Editor Control
	 *
	 * Main options:
	 *  name            => a name of the control
	 *  value           => a value to show in the control
	 *  default         => a default value of the control if the "value" option is not specified
	 *  tinymce         => an array of options for tinymce
	 * @link http://codex.wordpress.org/Function_Reference/wp_editor
	 *
	 * @author Alex Kovalev <alex.kovalevv@gmail.com>
	 * @copyright (c) 2018, Webcraftic Ltd
	 *
	 * @package factory-forms
	 * @since 1.0.0
	 */

	// Exit if accessed directly
	if( !defined('ABSPATH') ) {
		exit;
	}

	if( !class_exists('Wbcr_FactoryForms447_WpEditorControl') ) {

		class Wbcr_FactoryForms447_WpEditorControl extends Wbcr_FactoryForms447_Control {

			public $type = 'wp-editor';

			/**
			 * Preparing html attributes and options for tinymce.
			 *
			 * @since 1.0.0
			 * @return void
			 */
			protected function beforeHtml()
			{

				if( empty($this->options['tinymce']) ) {
					$this->options['tinymce'] = array();
				}

				if( !isset($this->options['tinymce']['content_css']) ) {
					$this->options['tinymce']['content_css'] = FACTORY_FORMS_447_URL . '/assets/css/editor.css';
				}
			}

			/**
			 * Shows the html markup of the control.
			 *
			 * @since 1.0.0
			 * @return void
			 */
			public function html()
			{
				$name_on_form = $this->getNameOnForm();

				$value = $this->getValue();

				?>
				<div class='factory-form-wp-editor'>
					<?php wp_editor($value, $name_on_form, array(
						'textarea_name' => $name_on_form,
						'wpautop' => false,
						'teeny' => true,
						'tinymce' => $this->getOption('tinymce', array()),
						'editor_height' => 213, // In pixels, takes precedence and has no default value
						'textarea_rows' => 10,  // Has no visible effect if editor_height is set, default is 20
					)); ?>
				</div>
			<?php
			}

			/**
			 * Returns a submit value of the control by a given name.
			 *
			 * @since 1.0.0
			 * @return mixed
			 */
			public function getSubmitValue($name, $subName)
			{
				$name_on_form = $this->getNameOnForm($name);

				$value = isset($_POST[$name_on_form])
					? $_POST[$name_on_form]
					: null;

				if( is_array($value) ) {
					$value = implode(',', $value);
				}

				return wp_kses_post($value);
			}
		}
	}