src/PicoAuthPlugin.php
public function onRequestFile(&$file)
    {
        // A special case for an error state of the plugin
        if ($this->errorOccurred) {
            $file = $this->requestFile;
            return;
        }

        try {
            // Resolve a normalized version of the url
            $realUrl = ($this->requestFile) ? $this->requestUrl : $this->resolveRealUrl($file);
            
            // Authorization
            if (!in_array($realUrl, $this->alwaysAllowed, true)) {
                $this->triggerEvent('denyAccessIfRestricted', [$realUrl]);
            }
        } catch (\Exception $e) {
            $realUrl = (isset($realUrl)) ? $realUrl : "";
            $this->errorHandler($e, $realUrl);
        }
        
        if ($this->requestFile) {
            $file = $this->requestFile;
        } else {
            switch ($this->requestUrl) {
                case 'login':
                    $file = $this->pluginDir . '/content/login.md';
                    break;
                case 'logout':
                    $file = $this->pluginDir . '/content/logout.md';
                    break;
            }
        }
    }
public function onRequestFile(&$file)
    {
        // A special case for an error state of the plugin
        if ($this->errorOccurred) {
            $file = $this->requestFile;
            return;
        }

        try {
            // Resolve a normalized version of the url
            $realUrl = ($this->requestFile) ? $this->requestUrl : $this->resolveRealUrl($file);
            
            // Authorization
            if (!in_array($realUrl, $this->alwaysAllowed, true)) {
                $this->triggerEvent('denyAccessIfRestricted', [$realUrl]);
            }
        } catch (\Exception $e) {
            $realUrl = (isset($realUrl)) ? $realUrl : "";
            $this->errorHandler($e, $realUrl);
        }
        
        if ($this->requestFile) {
            $file = $this->requestFile;
        } else {
            switch ($this->requestUrl) {
                case 'login':
                    $file = $this->pluginDir . '/content/login.md';
                    break;
                case 'logout':
                    $file = $this->pluginDir . '/content/logout.md';
                    break;
            }
        }
    }
Pico API event - onRequestFile

The plugin will change the requested file if the requested page
is one of the plugin's pages or if it has been set by one of the plugin's
modules in {@see PicoAuth::setRequestFile()}.

@param string $file Reference to the file name Pico will load.