| @@ 29-150 (lines=122) @@ | ||
| 26 | /** |
|
| 27 | * Class XoopsFormTinymce |
|
| 28 | */ |
|
| 29 | class XoopsFormTinymce extends XoopsEditor |
|
| 30 | { |
|
| 31 | var $language; |
|
| 32 | var $width = "100%"; |
|
| 33 | var $height = "500px"; |
|
| 34 | ||
| 35 | var $editor; |
|
| 36 | /** |
|
| 37 | * Constructor |
|
| 38 | * |
|
| 39 | * @param array $configs Editor Options |
|
| 40 | */ |
|
| 41 | function __construct($configs) |
|
| 42 | { |
|
| 43 | $current_path = __FILE__; |
|
| 44 | if (DIRECTORY_SEPARATOR != "/") { |
|
| 45 | $current_path = str_replace( strpos( $current_path, "\\\\", 2 ) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $current_path); |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->rootPath = "/class/xoopseditor/tinymce"; |
|
| 49 | parent::__construct($configs); |
|
| 50 | $this->configs["elements"] = $this->getName(); |
|
| 51 | $this->configs["language"] = $this->getLanguage(); |
|
| 52 | $this->configs["rootpath"] = $this->rootPath; |
|
| 53 | $this->configs["area_width"] = isset($this->configs["width"]) ? $this->configs["width"] : $this->width; |
|
| 54 | $this->configs["area_height"] = isset($this->configs["height"]) ? $this->configs["height"] : $this->height; |
|
| 55 | $this->configs["fonts"] = $this->getFonts(); |
|
| 56 | ||
| 57 | require_once __DIR__ . "/tinymce.php"; |
|
| 58 | $this->editor = new TinyMCE($this->configs); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * @param $configs |
|
| 63 | */ |
|
| 64 | function XoopsFormTinymce($configs) |
|
| 65 | { |
|
| 66 | $this->__construct($configs); |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Renders the Javascript function needed for client-side for validation |
|
| 71 | * |
|
| 72 | * I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE |
|
| 73 | * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616 |
|
| 74 | * |
|
| 75 | * @return string |
|
| 76 | */ |
|
| 77 | function renderValidationJS() |
|
| 78 | { |
|
| 79 | if ($this->isRequired() && $eltname = $this->getName()) { |
|
| 80 | //$eltname = $this->getName(); |
|
| 81 | $eltcaption = $this->getCaption(); |
|
| 82 | $eltmsg = empty($eltcaption) ? sprintf( _FORM_ENTER, $eltname ) : sprintf( _FORM_ENTER, $eltcaption ); |
|
| 83 | $eltmsg = str_replace('"', '\"', stripslashes( $eltmsg ) ); |
|
| 84 | $ret = "\n"; |
|
| 85 | $ret.= "if ( tinyMCE.get('{$eltname}').getContent() == \"\" || tinyMCE.get('{$eltname}').getContent() == null) "; |
|
| 86 | $ret.= "{ window.alert(\"{$eltmsg}\"); tinyMCE.get('{$eltname}').focus(); return false; }"; |
|
| 87 | ||
| 88 | return $ret; |
|
| 89 | } |
|
| 90 | ||
| 91 | return ''; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * get language |
|
| 96 | * |
|
| 97 | * @return string |
|
| 98 | */ |
|
| 99 | function getLanguage() |
|
| 100 | { |
|
| 101 | if ($this->language) { |
|
| 102 | return $this->language; |
|
| 103 | } |
|
| 104 | if (defined("_XOOPS_EDITOR_TINYMCE_LANGUAGE")) { |
|
| 105 | $this->language = strtolower(constant("_XOOPS_EDITOR_TINYMCE_LANGUAGE")); |
|
| 106 | } else { |
|
| 107 | $this->language = str_replace('_', '-', strtolower(_LANGCODE)); |
|
| 108 | if (strtolower(_CHARSET) == "utf-8") { |
|
| 109 | $this->language .= "_utf8"; |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||
| 113 | return $this->language; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @return mixed |
|
| 118 | */ |
|
| 119 | function getFonts() |
|
| 120 | { |
|
| 121 | if (empty($this->config["fonts"]) && defined("_XOOPS_EDITOR_TINYMCE_FONTS")) { |
|
| 122 | $this->config["fonts"] = constant("_XOOPS_EDITOR_TINYMCE_FONTS"); |
|
| 123 | } |
|
| 124 | ||
| 125 | return @$this->config["fonts"]; |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * prepare HTML for output |
|
| 130 | * |
|
| 131 | * @return sting HTML |
|
| 132 | */ |
|
| 133 | function render() |
|
| 134 | { |
|
| 135 | $ret = $this->editor->render(); |
|
| 136 | $ret .= parent::render(); |
|
| 137 | ||
| 138 | return $ret; |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * Check if compatible |
|
| 143 | * |
|
| 144 | * @return bool |
|
| 145 | */ |
|
| 146 | function isActive() |
|
| 147 | { |
|
| 148 | return is_readable(XOOPS_ROOT_PATH . $this->rootPath . "/tinymce.php"); |
|
| 149 | } |
|
| 150 | } |
|
| 151 | ||
| @@ 27-143 (lines=117) @@ | ||
| 24 | ||
| 25 | xoops_load('XoopsEditor'); |
|
| 26 | ||
| 27 | class XoopsFormTinymce4 extends XoopsEditor |
|
| 28 | { |
|
| 29 | var $language; |
|
| 30 | var $width = "100%"; |
|
| 31 | var $height = "500px"; |
|
| 32 | ||
| 33 | var $editor; |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Constructor |
|
| 37 | * |
|
| 38 | * @param array $configs Editor Options |
|
| 39 | */ |
|
| 40 | ||
| 41 | function __construct($configs) |
|
| 42 | { |
|
| 43 | $current_path = __FILE__; |
|
| 44 | if (DIRECTORY_SEPARATOR != "/") { |
|
| 45 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $current_path); |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->rootPath = "/class/xoopseditor/tinymce4"; |
|
| 49 | parent::__construct($configs); |
|
| 50 | $this->configs["elements"] = $this->getName(); |
|
| 51 | $this->configs["language"] = $this->getLanguage(); |
|
| 52 | $this->configs["rootpath"] = $this->rootPath; |
|
| 53 | $this->configs["area_width"] = isset($this->configs["width"]) ? $this->configs["width"] : $this->width; |
|
| 54 | $this->configs["area_height"] = isset($this->configs["height"]) ? $this->configs["height"] : $this->height; |
|
| 55 | $this->configs["fonts"] = $this->getFonts(); |
|
| 56 | ||
| 57 | require_once __DIR__ . "/tinymce.php"; |
|
| 58 | $this->editor = new TinyMCE($this->configs); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Renders the Javascript function needed for client-side for validation |
|
| 63 | * |
|
| 64 | * I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE |
|
| 65 | * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616 |
|
| 66 | * |
|
| 67 | * @return string |
|
| 68 | */ |
|
| 69 | ||
| 70 | function renderValidationJS() |
|
| 71 | { |
|
| 72 | if ($this->isRequired() && $eltname = $this->getName()) { |
|
| 73 | //$eltname = $this->getName(); |
|
| 74 | $eltcaption = $this->getCaption(); |
|
| 75 | $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
| 76 | $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
| 77 | $ret = "\n"; |
|
| 78 | $ret .= "if ( tinyMCE.get('{$eltname}').getContent() == \"\" || tinyMCE.get('{$eltname}').getContent() == null) "; |
|
| 79 | $ret .= "{ window.alert(\"{$eltmsg}\"); tinyMCE.get('{$eltname}').focus(); return false; }"; |
|
| 80 | ||
| 81 | return $ret; |
|
| 82 | } |
|
| 83 | ||
| 84 | return ''; |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * get language |
|
| 89 | * |
|
| 90 | * @return string |
|
| 91 | */ |
|
| 92 | ||
| 93 | function getLanguage() |
|
| 94 | { |
|
| 95 | if ($this->language) { |
|
| 96 | return $this->language; |
|
| 97 | } |
|
| 98 | if (defined("_XOOPS_EDITOR_TINYMCE4_LANGUAGE")) { |
|
| 99 | $this->language = strtolower(constant("_XOOPS_EDITOR_TINYMCE4_LANGUAGE")); |
|
| 100 | } else { |
|
| 101 | $this->language = str_replace('_', '-', strtolower(_LANGCODE)); |
|
| 102 | if (strtolower(_CHARSET) == "utf-8") { |
|
| 103 | $this->language .= "_utf8"; |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| 107 | return $this->language; |
|
| 108 | } |
|
| 109 | ||
| 110 | function getFonts() |
|
| 111 | { |
|
| 112 | if (empty($this->config["fonts"]) && defined("_XOOPS_EDITOR_TINYMCE4_FONTS")) { |
|
| 113 | $this->config["fonts"] = constant("_XOOPS_EDITOR_TINYMCE4_FONTS"); |
|
| 114 | } |
|
| 115 | ||
| 116 | return @$this->config["fonts"]; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * prepare HTML for output |
|
| 121 | * |
|
| 122 | * @return sting HTML |
|
| 123 | */ |
|
| 124 | ||
| 125 | function render() |
|
| 126 | { |
|
| 127 | $ret = $this->editor->render(); |
|
| 128 | $ret .= parent::render(); |
|
| 129 | ||
| 130 | return $ret; |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Check if compatible |
|
| 135 | * |
|
| 136 | * @return |
|
| 137 | */ |
|
| 138 | ||
| 139 | function isActive() |
|
| 140 | { |
|
| 141 | return is_readable(XOOPS_ROOT_PATH . $this->rootPath . "/tinymce.php"); |
|
| 142 | } |
|
| 143 | } |
|
| 144 | ||
| 145 | ?> |
|
| 146 | ||
| @@ 26-139 (lines=114) @@ | ||
| 23 | ||
| 24 | xoops_load('XoopsEditor'); |
|
| 25 | ||
| 26 | class XoopsFormTinymceJQ extends XoopsEditor |
|
| 27 | { |
|
| 28 | var $language; |
|
| 29 | var $width = "100%"; |
|
| 30 | var $height = "500px"; |
|
| 31 | ||
| 32 | var $editor; |
|
| 33 | /** |
|
| 34 | * Constructor |
|
| 35 | * |
|
| 36 | * @param array $configs Editor Options |
|
| 37 | */ |
|
| 38 | function __construct($configs) |
|
| 39 | { |
|
| 40 | $current_path = __FILE__; |
|
| 41 | if ( DIRECTORY_SEPARATOR != "/" ) { |
|
| 42 | $current_path = str_replace( strpos( $current_path, "\\\\", 2 ) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $current_path); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->rootPath = "/class/xoopseditor/tinymcejquery"; |
|
| 46 | parent::__construct($configs); |
|
| 47 | $this->configs["elements"] = $this->getName(); |
|
| 48 | $this->configs["language"] = $this->getLanguage(); |
|
| 49 | $this->configs["rootpath"] = $this->rootPath; |
|
| 50 | $this->configs["area_width"] = isset($this->configs["width"]) ? $this->configs["width"] : $this->width; |
|
| 51 | $this->configs["area_height"] = isset($this->configs["height"]) ? $this->configs["height"] : $this->height; |
|
| 52 | $this->configs["fonts"] = $this->getFonts(); |
|
| 53 | ||
| 54 | require_once dirname(__FILE__) . "/tinymce.php"; |
|
| 55 | $this->editor = new TinyMCEJQ($this->configs); |
|
| 56 | } |
|
| 57 | ||
| 58 | function XoopsFormTinymce($configs) |
|
| 59 | { |
|
| 60 | $this->__construct($configs); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Renders the Javascript function needed for client-side for validation |
|
| 65 | * |
|
| 66 | * I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE |
|
| 67 | * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616 |
|
| 68 | * |
|
| 69 | * @return string |
|
| 70 | */ |
|
| 71 | function renderValidationJS() |
|
| 72 | { |
|
| 73 | if ($this->isRequired() && $eltname = $this->getName()) { |
|
| 74 | //$eltname = $this->getName(); |
|
| 75 | $eltcaption = $this->getCaption(); |
|
| 76 | $eltmsg = empty($eltcaption) ? sprintf( _FORM_ENTER, $eltname ) : sprintf( _FORM_ENTER, $eltcaption ); |
|
| 77 | $eltmsg = str_replace('"', '\"', stripslashes( $eltmsg ) ); |
|
| 78 | $ret = "\n"; |
|
| 79 | $ret.= "if ( tinyMCE.get('{$eltname}').getContent() == \"\" || tinyMCE.get('{$eltname}').getContent() == null) "; |
|
| 80 | $ret.= "{ window.alert(\"{$eltmsg}\"); tinyMCE.get('{$eltname}').focus(); return false; }"; |
|
| 81 | return $ret; |
|
| 82 | } |
|
| 83 | return ''; |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * get language |
|
| 88 | * |
|
| 89 | * @return string |
|
| 90 | */ |
|
| 91 | function getLanguage() |
|
| 92 | { |
|
| 93 | if ($this->language) { |
|
| 94 | return $this->language; |
|
| 95 | } |
|
| 96 | if (defined("_XOOPS_EDITOR_TINYMCEJQ_LANGUAGE")) { |
|
| 97 | $this->language = strtolower(constant("_XOOPS_EDITOR_TINYMCEJQ_LANGUAGE")); |
|
| 98 | } else { |
|
| 99 | $this->language = str_replace('_', '-', strtolower(_LANGCODE)); |
|
| 100 | if(strtolower(_CHARSET) == "utf-8") { |
|
| 101 | $this->language .= "_utf8"; |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| 105 | return $this->language; |
|
| 106 | } |
|
| 107 | ||
| 108 | function getFonts() |
|
| 109 | { |
|
| 110 | if (empty($this->config["fonts"]) && defined("_XOOPS_EDITOR_TINYMCEJQ_FONTS")) { |
|
| 111 | $this->config["fonts"] = constant("_XOOPS_EDITOR_TINYMCEJQ_FONTS"); |
|
| 112 | } |
|
| 113 | ||
| 114 | return @$this->config["fonts"]; |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * prepare HTML for output |
|
| 119 | * |
|
| 120 | * @return sting HTML |
|
| 121 | */ |
|
| 122 | function render() |
|
| 123 | { |
|
| 124 | $ret = $this->editor->render(); |
|
| 125 | $ret .= parent::render(); |
|
| 126 | ||
| 127 | return $ret; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * Check if compatible |
|
| 132 | * |
|
| 133 | * @return |
|
| 134 | */ |
|
| 135 | function isActive() |
|
| 136 | { |
|
| 137 | return is_readable(XOOPS_ROOT_PATH . $this->rootPath . "/tinymce.php"); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ?> |
|
| 141 | ||
| @@ 27-143 (lines=117) @@ | ||
| 24 | ||
| 25 | xoops_load('XoopsEditor'); |
|
| 26 | ||
| 27 | class XoopsFormTinymce4Bootstrap extends XoopsEditor |
|
| 28 | { |
|
| 29 | public $language; |
|
| 30 | public $width = '100%'; |
|
| 31 | public $height = '500px'; |
|
| 32 | ||
| 33 | public $editor; |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Constructor |
|
| 37 | * |
|
| 38 | * @param array $configs Editor Options |
|
| 39 | */ |
|
| 40 | ||
| 41 | public function __construct($configs) |
|
| 42 | { |
|
| 43 | $current_path = __FILE__; |
|
| 44 | if (DIRECTORY_SEPARATOR !== '/') { |
|
| 45 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->rootPath = '/class/xoopseditor/tinymce4bootstrap'; |
|
| 49 | parent::__construct($configs); |
|
| 50 | $this->configs['elements'] = $this->getName(); |
|
| 51 | $this->configs['language'] = $this->getLanguage(); |
|
| 52 | $this->configs['rootpath'] = $this->rootPath; |
|
| 53 | $this->configs['area_width'] = isset($this->configs['width']) ? $this->configs['width'] : $this->width; |
|
| 54 | $this->configs['area_height'] = isset($this->configs['height']) ? $this->configs['height'] : $this->height; |
|
| 55 | $this->configs['fonts'] = $this->getFonts(); |
|
| 56 | ||
| 57 | require_once __DIR__ . '/tinymce.php'; |
|
| 58 | $this->editor = new TinyMCE($this->configs); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Renders the Javascript function needed for client-side for validation |
|
| 63 | * |
|
| 64 | * I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE |
|
| 65 | * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616 |
|
| 66 | * |
|
| 67 | * @return string |
|
| 68 | */ |
|
| 69 | ||
| 70 | public function renderValidationJS() |
|
| 71 | { |
|
| 72 | if ($this->isRequired() && $eltname = $this->getName()) { |
|
| 73 | //$eltname = $this->getName(); |
|
| 74 | $eltcaption = $this->getCaption(); |
|
| 75 | $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
| 76 | $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
| 77 | $ret = "\n"; |
|
| 78 | $ret .= "if ( tinyMCE.get('{$eltname}').getContent() == \"\" || tinyMCE.get('{$eltname}').getContent() == null) "; |
|
| 79 | $ret .= "{ window.alert(\"{$eltmsg}\"); tinyMCE.get('{$eltname}').focus(); return false; }"; |
|
| 80 | ||
| 81 | return $ret; |
|
| 82 | } |
|
| 83 | ||
| 84 | return ''; |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * get language |
|
| 89 | * |
|
| 90 | * @return string |
|
| 91 | */ |
|
| 92 | ||
| 93 | public function getLanguage() |
|
| 94 | { |
|
| 95 | if ($this->language) { |
|
| 96 | return $this->language; |
|
| 97 | } |
|
| 98 | if (defined('_XOOPS_EDITOR_TINYMCE4_LANGUAGE')) { |
|
| 99 | $this->language = strtolower(constant('_XOOPS_EDITOR_TINYMCE4_LANGUAGE')); |
|
| 100 | } else { |
|
| 101 | $this->language = str_replace('_', '-', strtolower(_LANGCODE)); |
|
| 102 | if ('utf-8' === strtolower(_CHARSET)) { |
|
| 103 | $this->language .= '_utf8'; |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| 107 | return $this->language; |
|
| 108 | } |
|
| 109 | ||
| 110 | public function getFonts() |
|
| 111 | { |
|
| 112 | if (empty($this->config['fonts']) && defined('_XOOPS_EDITOR_TINYMCE4_FONTS')) { |
|
| 113 | $this->config['fonts'] = constant('_XOOPS_EDITOR_TINYMCE4_FONTS'); |
|
| 114 | } |
|
| 115 | ||
| 116 | return @$this->config['fonts']; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * prepare HTML for output |
|
| 121 | * |
|
| 122 | * @return sting HTML |
|
| 123 | */ |
|
| 124 | ||
| 125 | public function render() |
|
| 126 | { |
|
| 127 | $ret = $this->editor->render(); |
|
| 128 | $ret .= parent::render(); |
|
| 129 | ||
| 130 | return $ret; |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Check if compatible |
|
| 135 | * |
|
| 136 | * @return bool |
|
| 137 | */ |
|
| 138 | ||
| 139 | public function isActive() |
|
| 140 | { |
|
| 141 | return is_readable(XOOPS_ROOT_PATH . $this->rootPath . '/tinymce.php'); |
|
| 142 | } |
|
| 143 | } |
|
| 144 | ||
| 145 | ||