/** * Outputs the HTML for a single instance of the editor. * * @param string $content The initial content of the editor. * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers). * @param array $settings See the _parse_settings() method for description. */ public static function editor($content, $editor_id, $settings = array()) { $set = self::parse_settings($editor_id, $settings); $editor_class = ' class="' . trim($set['editor_class'] . ' nxt-editor-area') . '"'; $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; $rows = ' rows="' . (int) $set['textarea_rows'] . '"'; $switch_class = 'html-active'; $toolbar = $buttons = ''; if (!current_user_can('upload_files')) { $set['media_buttons'] = false; } if (self::$this_quicktags && self::$this_tinymce) { $switch_class = 'html-active'; if ('html' == nxt_default_editor()) { add_filter('the_editor_content', 'nxt_htmledit_pre'); } else { add_filter('the_editor_content', 'nxt_richedit_pre'); $switch_class = 'tmce-active'; } $buttons .= '<a id="' . $editor_id . '-html" class="hide-if-no-js nxt-switch-editor switch-html" onclick="switchEditors.switchto(this);">' . __('HTML') . "</a>\n"; $buttons .= '<a id="' . $editor_id . '-tmce" class="hide-if-no-js nxt-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">' . __('Visual') . "</a>\n"; } echo '<div id="nxt-' . $editor_id . '-wrap" class="nxt-editor-wrap ' . $switch_class . '">'; if (self::$editor_buttons_css) { nxt_print_styles('editor-buttons'); self::$editor_buttons_css = false; } if (!empty($set['editor_css'])) { echo $set['editor_css'] . "\n"; } if (!empty($buttons) || $set['media_buttons']) { echo '<div id="nxt-' . $editor_id . '-editor-tools" class="nxt-editor-tools">'; echo $buttons; if ($set['media_buttons']) { self::$has_medialib = true; if (!function_exists('media_buttons')) { include ABSPATH . 'nxt-admin/includes/media.php'; } echo '<div id="nxt-' . $editor_id . '-media-buttons" class="hide-if-no-js nxt-media-buttons">'; do_action('media_buttons', $editor_id); echo "</div>\n"; } echo "</div>\n"; } $the_editor = apply_filters('the_editor', '<div id="nxt-' . $editor_id . '-editor-container" class="nxt-editor-container"><textarea' . $editor_class . $rows . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>'); $content = apply_filters('the_editor_content', $content); printf($the_editor, $content); echo "\n</div>\n\n"; self::editor_settings($editor_id, $set); }