Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/2amigos/yii2-tinymce-widget/src/ |
Upload File : |
<?php /** * @copyright Copyright (c) 2013-2017 2amigOS! Consulting Group LLC * @link http://2amigos.us * @license http://www.opensource.org/licenses/bsd-license.php New BSD License */ namespace dosamigos\tinymce; use yii\helpers\Html; use yii\helpers\Json; use yii\widgets\InputWidget; /** * * TinyMCE renders a tinyMCE js plugin for WYSIWYG editing. * * @author Antonio Ramirez <amigo.cobos@gmail.com> * @link http://www.ramirezcobos.com/ * @link http://www.2amigos.us/ */ class TinyMce extends InputWidget { /** * @var string the language to use. Defaults to null (en). */ public $language; /** * @var array the options for the TinyMCE JS plugin. * Please refer to the TinyMCE JS plugin Web page for possible options. * @see http://www.tinymce.com/wiki.php/Configuration */ public $clientOptions = []; /** * @var bool whether to set the on change event for the editor. This is required to be able to validate data. * @see https://github.com/2amigos/yii2-tinymce-widget/issues/7 */ public $triggerSaveOnBeforeValidateForm = true; /** * @inheritdoc */ public function run() { if ($this->hasModel()) { echo Html::activeTextarea($this->model, $this->attribute, $this->options); } else { echo Html::textarea($this->name, $this->value, $this->options); } $this->registerClientScript(); } /** * Registers tinyMCE js plugin */ protected function registerClientScript() { $js = []; $view = $this->getView(); TinyMceAsset::register($view); $id = $this->options['id']; $this->clientOptions['selector'] = "#$id"; // @codeCoverageIgnoreStart if ($this->language !== null && $this->language !== 'en') { $langFile = "langs/{$this->language}.js"; $langAssetBundle = TinyMceLangAsset::register($view); $langAssetBundle->js[] = $langFile; $this->clientOptions['language_url'] = $langAssetBundle->baseUrl . "/{$langFile}"; $this->clientOptions['language'] = "{$this->language}";//Language fix. Without it EN language when add some plugins like codemirror } // @codeCoverageIgnoreEnd $options = Json::encode($this->clientOptions); $js[] = "tinymce.init($options);"; if ($this->triggerSaveOnBeforeValidateForm) { $js[] = "$('#{$id}').parents('form').on('beforeValidate', function() { tinymce.triggerSave(); });"; } $view->registerJs(implode("\n", $js)); } }