optimization: let get_frontend_media() return a shared instance.

Note: this may cause problems when users expected the media to be
editable, but that is not a common pattern (media += other media is).
Add 'local' or 'external' flag to render_content_items_media.

This simplifies compression support for frontend media,
when plugins also include external resources (e.g. Google Maps).