protected function initialize()
 {
     parent::initialize();
     if (!empty($this->button_filters)) {
         foreach ($this->button_filters as $filter_name => $filter) {
             if (preg_match('/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name) && !empty($filter) && is_callable($filter)) {
                 add_filter($filter_name, array($this, $filter_name), 10, 2);
             }
         }
     }
 }
示例#2
0
 protected function initialize()
 {
     parent::initialize();
     add_filter('mce_buttons', array($this, 'mce_buttons_filter'), 10, 2);
     add_filter('quicktags_settings', array($this, 'quicktags_settings'), 10, 2);
     if (!empty($this->button_filters)) {
         foreach ($this->button_filters as $filter_name => $filter) {
             if (preg_match('/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name) && !empty($filter) && is_callable($filter)) {
                 add_filter($filter_name, array($this, $filter_name), 10, 2);
             }
         }
     }
     if (class_exists('WC_Shortcodes_Admin')) {
         $screen = get_current_screen();
         if (!is_null($screen) && $screen->id != 'widgets') {
             add_filter('mce_external_plugins', array($this, 'add_wc_shortcode_plugin'), 15);
             add_filter('mce_buttons', array($this, 'register_wc_shortcode_button'), 15);
         }
     }
 }