Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! defined( 'ABSPATH' ) )
- die( "Can't load this file directly" );
- class wppaGallery
- {
- function __construct() {
- add_action( 'admin_init', array( $this, 'action_admin_init' ) );
- }
- function action_admin_init() {
- // only hook up these filters if we're in the admin panel, and the current user has permission
- // to edit posts and pages
- if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
- add_filter( 'mce_buttons', array( $this, 'filter_mce_button' ) );
- add_filter( 'mce_external_plugins', array( $this, 'filter_mce_plugin' ) );
- }
- }
- function filter_mce_button( $buttons ) {
- // add a separation before our button.
- array_push( $buttons, '|', 'wppa_button' );
- return $buttons;
- }
- function filter_mce_plugin( $plugins ) {
- // this plugin file will work the magic of our button
- $plugins['wppa'] = plugin_dir_url( __FILE__ ) . 'wppa_plugin.js';
- return $plugins;
- }
- }
- $wppagallery = new wppaGallery();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement