<?php

if (!defined('DOKU_INC')) die();


/**
 *
 * To add the manifest image
 *
 * https://www.dokuwiki.org/devel:manifest
 *
 * @see <a href="https://combostrap.com/manifest">manifest</a>
 *
 */

class action_plugin_combo_manifest extends DokuWiki_Action_Plugin
{


    function register(Doku_Event_Handler $controller)
    {

        /* This will call the function _manifest */
        $controller->register_hook(
            'MANIFEST_SEND',
            'BEFORE',
            $this,
            '_manifest',
            array()
        );


    }


    /**
     * Main function; dispatches the visual comment actions
     * @param   $event Doku_Event
     *
     * We take into account the file generated by https://realfavicongenerator.net/
     *
     *
     *
     */
    function _manifest(&$event, $param)
    {

        $mediaId = ":android-chrome-192x192.png";
        $mediaFile = mediaFN($mediaId);
        if (file_exists($mediaFile)){
            $url = ml($mediaId, '', true, '', true);
            $event->data['icons'][]=
                array(
                    "src" => $url,
                    "sizes" => "192x192",
                    "type" => "image/png"
                );
        }

    }




}
