tag, then the tag will be highlighted using a class named aphsh-pretag-focused * so we need to remove it before save into database */ add_action( 'content_save_pre', array($this, 'clean_tag'), 10, 2 ); $this->options = get_option(APHSH_OPTION); $this->aphsh_data = get_option(APHSH_OPTION_SHDATA); } public function admin_comments_form ($screen) { if ($screen->id == 'edit-comments') { $this->add_modal_dialog(); } } public function add_modal_dialog() { $lang_list = $this->aphsh_data['lang-list'][$this->options['lang-pack']]; foreach ($lang_list as $lang => $lang_name) { $selected = $lang == $this->options['default-lang'] ? ' selected="selected"' : ''; $lang_options .= ''; } echo '
APH Syntax Highlighter
Language Highlight Line e.q: 1,2,3-6

Other Options

'; /* Options, used to change the language dropdown menu to default value, * we don,t use global variable, so we use this */ echo ''; } public function aphsh_button() { add_filter( 'mce_external_plugins', array($this, 'aphsh_add_buttons') ); add_filter( 'mce_buttons', array($this, 'aphsh_register_buttons') ); } public function aphsh_add_buttons( $plugin_array ) { $plugin_array['aphsh_tinymce_btn'] = APHSH_PLUGIN_URL . '/js/aphsh-tinymce.js?r='.time(); return $plugin_array; } public function aphsh_register_buttons( $buttons ) { array_push( $buttons, 'aphsh'); return $buttons; } private function register_scripts() { wp_enqueue_style('aphsh-code-editor', APHSH_PLUGIN_URL . '/css/aphsh-code-editor.css'); wp_enqueue_style('aphsh-icomoon', APHSH_PLUGIN_URL . '/css/icomoon/style.css'); wp_enqueue_script('aphsh-taboverride', APHSH_PLUGIN_URL . '/js/taboverride/taboverride.min.js'); wp_enqueue_script('aphsh-admin-editor', APHSH_PLUGIN_URL . '/js/aphsh-admin-editor.js', 'jquery', ''); } // Add editor to admin comment public function register_scripts_comments($screen) { if ($screen->id == 'edit-comments') { $this->register_scripts(); } } // Add editor to add or edit post / page public function register_scripts_post($hook) { if ( $hook == 'post-new.php' || $hook == 'post.php' ) { $this->register_scripts(); } } public function aphsh_tinymce_editor_css($wp) { $wp .= ',' . APHSH_PLUGIN_URL . '/css/aphsh-tinymce-editor.css'; return $wp; } public function clean_tag($content) { return preg_replace('/\s*aphsh-pretag-focused\s*/', '', $content); } }