function __construct($plugin_name, $plugin_dir, $buttons = array(), $level = 3) { // init process for button control if (!self::$action_added) { add_action('admin_head', array(__CLASS__, 'add_buttons')); self::$action_added = true; } }
function __construct($plugin_name, $plugin_dir, $buttons = array(), $level = 3) { $level = absint($level); // store plugin name and dir self::$plugins[$plugin_dir] = $plugin_name; // create level subarray if (!isset(self::$buttons[$level])) { self::$buttons[$level] = array(); } // if set - store custom buttons // it must be array self::$buttons[$level][$plugin_name] = empty($buttons) ? array($plugin_name) : (array) $buttons; // init process for button control if (!self::$action_added) { add_action('admin_head', array(__CLASS__, 'add_buttons')); self::$action_added = true; } }