public function can_output() { $screen = ''; $can = true; if (function_exists('get_current_screen')) { $screen = get_current_screen(); $screen = $screen->id; } // if in post / page if (VP_Metabox::_is_post_or_page()) { // then consider the types if (!in_array("*", $this->types)) { // if wildcard exists, then always shows $can &= in_array(VP_Metabox::_get_current_post_type(), $this->types); } else { $can &= true; } } else { // if not, only consider the screen id if (!empty($screen)) { $can &= in_array($screen, $this->included_pages); } else { if (!is_admin()) { $can &= false; } } } return $can; }
public static function init_buttons() { if (VP_Metabox::_is_post_or_page() && !current_user_can('edit_posts') && !current_user_can('edit_pages') && get_user_option('rich_editing') == 'true') { return; } add_filter('mce_external_plugins', array(__CLASS__, 'add_buttons')); add_filter('mce_buttons', array(__CLASS__, 'register_buttons')); add_filter('wp_fullscreen_buttons', array(__CLASS__, 'fullscreen_buttons')); add_filter('admin_print_styles', array(__CLASS__, 'print_styles')); }