library/Admin/TinyMce/PluginClass.php
public function setupTinymcePlugin()
    {
        if (! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
            return;
        }

        // Check if the logged in WordPress User has the Visual Editor enabled
        // If not, don't register our TinyMCE plugin
        if (get_user_option('rich_editing') !== 'true') {
            return;
        }

        $this->init();

        if (!$this->pluginSlug || !$this->pluginSlug) {
            return;
        }

        //Change button row placement if buttonRow is defined
        if (isset($this->buttonRow) && is_numeric($this->buttonRow) && $this->buttonRow > 1) {
            $this->buttonFilter .= '_' . $this->buttonRow;
        }

        //LocalizeData (if any)
        if (is_array($this->data) && !empty($this->data)) {
            add_action('admin_head', array($this, 'localizeScript'));
        }

        add_filter('mce_external_plugins', array($this, 'addTinyMcePlugin'));
        add_filter($this->buttonFilter, array($this, 'addTinymceToolbarButton' ));
    }
public function setupTinymcePlugin()
    {
        if (! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
            return;
        }

        // Check if the logged in WordPress User has the Visual Editor enabled
        // If not, don't register our TinyMCE plugin
        if (get_user_option('rich_editing') !== 'true') {
            return;
        }

        $this->init();

        if (!$this->pluginSlug || !$this->pluginSlug) {
            return;
        }

        //Change button row placement if buttonRow is defined
        if (isset($this->buttonRow) && is_numeric($this->buttonRow) && $this->buttonRow > 1) {
            $this->buttonFilter .= '_' . $this->buttonRow;
        }

        //LocalizeData (if any)
        if (is_array($this->data) && !empty($this->data)) {
            add_action('admin_head', array($this, 'localizeScript'));
        }

        add_filter('mce_external_plugins', array($this, 'addTinyMcePlugin'));
        add_filter($this->buttonFilter, array($this, 'addTinymceToolbarButton' ));
    }
public function setupTinymcePlugin ( ) { if ( ! current_user_can ( 'edit_posts' ) && ! current_user_can ( 'edit_pages' ) ) { return ; } // Check if the logged in WordPress User has the Visual Editor enabled // If not, don't register our TinyMCE plugin if ( get_user_option ( 'rich_editing' ) !== 'true' ) { return ; } $ this -> init ( ) ; if ( ! $ this -> pluginSlug || ! $ this -> pluginSlug ) { return ; } //Change button row placement if buttonRow is defined if ( isset ( $ this -> buttonRow ) && is_numeric ( $ this -> buttonRow ) && $ this -> buttonRow > 1 ) { $ this -> buttonFilter .= '_' . $ this -> buttonRow ; } //LocalizeData (if any) if ( is_array ( $ this -> data ) && ! empty ( $ this -> data ) ) { add_action ( 'admin_head' , array ( $ this , 'localizeScript' ) ) ; } add_filter ( 'mce_external_plugins' , array ( $ this , 'addTinyMcePlugin' ) ) ; add_filter ( $ this -> buttonFilter , array ( $ this , 'addTinymceToolbarButton' ) ) ; }
Check if the current user can edit Posts or Pages, and is using the Visual Editor
If so, add some filters so we can register our plugin
Check if the current user can edit Posts or Pages and is using the Visual Editor If so add some filters so we can register our plugin