owncloud/core — pull request #4339 by icewind1991 (2013-08-07 15:02:49+00:00)
Title: Add the option to provide templates for newly created files

This gives apps the option to define a template for newly created files based on the mimetype, for example newly created html files automatically get filled with [basic html boilerplate](https://github.com/owncloud/core/blob/1c1ede57034343830696667820115435db5509ba/core/templates/filetemplates/template.html).

Apps can currently define templates the following way:
`OC_Helper::getFileTemplateManager()->registerTemplate('foo/bar', 'path/to/template.txt')`

Other options for templates can be xml files, [markdown files](https://github.com/icewind1991/owncloud-markdown), [reveal.js files](https://github.com/icewind1991/reveal) or any other filetype where having a basic boilerplate helps.

Additionally this code splits of the mimetype detection code from OC_Helper to cleanup that class a bit, a side effect from this is that apps can now define their own extension -> mimetype mappings which removes the need to patch core when creating an app that handles a custom mimetype.

Apps can register a mimetype for files ending with `.bar` by doing
`OC_Helper::getMimetypeDetector()->registerType('bar', 'foo/bar')`

Testing can be done by creating a new html file and opening it in the editor

cc @jancborchardt @karlitschek @DeepDiver1975 @tanghus @bartv2