After a brainstorming session with Nico, who is fast becoming number 2 portfolio api ninja, we thought the following was the best approach:
- change supported_formats in the caller to always be called statically and accept the caller object optionally. This means it can essentially support static and not static calls, by the implementer testing for empty($caller) rather than having to do isset($this) && $this instanceof whateverclass (which I thought was too hard for implementers to have to worry about)
- allow an extra argument to portfolio_add_button - so that if the calling code knows better than the static function in the caller class does about what formats are going to be allowed (eg if it knows a file is an image) it can override it.
I'm going to sit on this for a little bit in case I have any further ideas, but that's the current plan.