1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: $plugin_is_filter = 5 | ADMIN_PLUGIN;
17: $plugin_description = gettext("Text editor TinyMCE 4.x");
18: $plugin_author = "Malte Müller (acrylian)";
19: $option_interface = 'tinymce4Options';
20:
21: if (!defined('EDITOR_SANITIZE_LEVEL'))
22: define('EDITOR_SANITIZE_LEVEL', 4);
23: zp_register_filter('texteditor_config', 'tinymce4ConfigJS');
24:
25: 26: 27: 28:
29: class tinymce4Options {
30:
31: function __construct() {
32: setOptionDefault('tinymce4_zenphoto', 'zenphoto-ribbon.js.php');
33: setOptionDefault('tinymce4_zenpage', 'zenpage-slim.js.php');
34: if (getOption('zp_plugin_tiny_mce')) {
35: setOptionDefault('zp_plugin_tinymce4', 5 | ADMIN_PLUGIN);
36: purgeOption('zp_plugin_tiny_mce');
37: }
38: }
39:
40: function getOptionsSupported() {
41: $configs_zenpage = getTinyMCE4ConfigFiles('zenpage');
42: $configs_zenphoto = getTinyMCE4ConfigFiles('zenphoto');
43: $options = array(gettext('Text editor configuration - Zenphoto') => array('key' => 'tinymce4_zenphoto', 'type' => OPTION_TYPE_SELECTOR,
44: 'order' => 0,
45: 'selections' => $configs_zenphoto,
46: 'null_selection' => gettext('Disabled'),
47: 'desc' => gettext('Applies to <em>admin</em> editable text other than for Zenpage pages and news articles.')),
48: gettext('Text editor configuration - Zenpage') => array('key' => 'tinymce4_zenpage', 'type' => OPTION_TYPE_SELECTOR,
49: 'order' => 0,
50: 'selections' => $configs_zenpage,
51: 'null_selection' => gettext('Disabled'),
52: 'desc' => gettext('Applies to editing on the Zenpage <em>pages</em> and <em>news</em> tabs.')),
53: gettext('Custom image size') => array('key' => 'tinymce_tinyzenpage_customimagesize', 'type' => OPTION_TYPE_TEXTBOX,
54: 'order' => 2,
55: 'desc' => gettext("Predefined size (px) for custom size images included using tinyZenpage.")),
56: gettext('Custom image size') => array('key' => 'tinymce_tinyzenpage_customimagesize', 'type' => OPTION_TYPE_TEXTBOX,
57: 'order' => 2,
58: 'desc' => gettext("Predefined size (px) for custom size images included using tinyZenpage.")),
59: gettext('Custom thumb crop - size') => array('key' => 'tinymce_tinyzenpage_customthumb_size', 'type' => OPTION_TYPE_TEXTBOX,
60: 'order' => 2,
61: 'desc' => gettext("Predefined size (px) for custom cropped thumb images included using tinyZenpage.")),
62: gettext('Custom thumb crop - width') => array('key' => 'tinymce_tinyzenpage_customthumb_cropwidth', 'type' => OPTION_TYPE_TEXTBOX,
63: 'order' => 2,
64: 'desc' => gettext("Predefined crop width (%) for custom cropped thumb images included using tinyZenpage.")),
65: gettext('Custom thumb crop - height') => array('key' => 'tinymce_tinyzenpage_customthumb_cropheight', 'type' => OPTION_TYPE_TEXTBOX,
66: 'order' => 2,
67: 'desc' => gettext("Predefined crop height (%) for custom cropped thumb images included using tinyZenpage."))
68: );
69: return $options;
70: }
71:
72: function handleOption($option, $currentValue) {
73:
74: }
75:
76: }
77:
78: function tinymce4ConfigJS($mode) {
79: global $_editorconfig;
80: if (empty($_editorconfig)) {
81: $locale = 'en';
82: $loc = str_replace('_', '-', getOption("locale"));
83: if ($loc) {
84: if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce4/langs/' . $loc . '.js')) {
85: $locale = $loc;
86: } else {
87: $loc = substr($loc, 0, 2);
88: if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/tinymce4/langs/' . $loc . '.js')) {
89: $locale = $loc;
90: }
91: }
92: }
93:
94: $_editorconfig = getOption('tinymce4_' . $mode);
95: if (!empty($_editorconfig)) {
96: $_editorconfig = getPlugin('/tinymce4/config/' . $_editorconfig, true);
97: if (!empty($_editorconfig)) {
98: require_once($_editorconfig);
99: }
100: }
101: }
102: return $mode;
103: }
104:
105: function getTinyMCE4ConfigFiles($mode) {
106:
107: $files = getPluginFiles($mode . '-*.js.php', 'tinymce4/config/');
108: $array = array();
109: foreach ($files as $file) {
110: $filename = strrchr($file, '/');
111: $filename = substr($filename, 1);
112: $option = preg_replace('/^' . $mode . '-/', '', $filename);
113: $option = ucfirst(preg_replace('/.js.php$/', '', $option));
114: $array[$option] = $filename;
115: }
116: return $array;
117: }
118:
119: ?>