示例#1
0
    def __call__(self):
        self.request.response.setHeader('Content-type', 'application/json')
        title = api.portal.get_registry_record('plone.short_site_title')
        if not title:
            title = api.portal.get_registry_record('plone.site_title')
        if not site_has_icon():
            return '{"name": "%(site_title)s"}' % dict(site_title=title)

        return '''{
    "name": "%(site_title)s",
    "icons": [
        {
            "src": "%(url)s/site-icon.png?scale=192",
            "sizes": "192x192",
            "type": "image\/png"
        },
        {
            "src": "%(url)s/site-icon.png?scale=512",
            "sizes": "512x512",
            "type": "image\/png"
        }
    ],
    "theme_color": "#ffffff",
    "display": "standalone"
}''' % dict(url=self.context.absolute_url(),
            site_title=title)
示例#2
0
    def get_icons(self):
        if not site_has_icon():
            return ''
        return '''
<link rel="apple-touch-icon" sizes="180x180" href="{url}/site-icon.png">
<link rel="icon" type="image/png" href="{url}/site-icon.png?scale=32" sizes="32x32">
<link rel="icon" type="image/png" href="{url}/site-icon.png?scale=16" sizes="16x16">
<link rel="manifest" href="{url}/manifest.json">
<meta name="theme-color" content="#ffffff">'''.format(url=self.root_url)
示例#3
0
    def __call__(self):
        self.request.response.setHeader('Content-type', 'text/xml')
        if not site_has_icon():
            return '''<?xml version="1.0" encoding="utf-8"?>
    <browserconfig>
    </browserconfig>'''

        return '''<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
  <msapplication>
    <tile>
      <square150x150logo src="{url}/site-icon.png?scale=150"/>
      <TileColor>#da532c</TileColor>
    </tile>
  </msapplication>
</browserconfig>
'''.format(url=self.context.absolute_url())