====== HandleRequest ======
**Layer:** ''Core'' · **Source:** ''lib/core/HandleRequest.php:30'' (lines 30–595)
----
final class HandleRequest
Static facade used by Dispatcher to dispatch front-end requests when
SEO-friendly (pretty) permalinks are disabled. It parses the request URI
and query string, validates the requested path against a whitelist, and
renders the matching template (or delegates to a registered
FrontRequestHandler).
======= Docblock Metadata =======
^ Tag ^ Value ^
| ''@category'' | Core Class |
| ''@author'' | M.Noermoehammad |
| ''@license'' | MIT |
| ''@version'' | 1.1 |
| ''@since'' | Since Release 1.0 |
======= Inheritance =======
//No parent, interface or trait. This is a root type.//
======= Constants (0) =======
//None.//
======= Properties (4) =======
^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private static'' | ''static'' | ''$queryStringParsed'' | | 41 |
| ''private static'' | ''static'' | ''$requestPathProcessed'' | | 48 |
| ''private static'' | ''static'' | ''$frontHelper'' | | 56 |
| ''private static'' | ''static ?ThemeRendererInterface'' | ''$themeRenderer'' | ''null'' | 63 |
======= Methods (22) =======
^ Visibility ^ Method ^ Summary ^ Line ^
| public static | ''setThemeRenderer()'' | Set the ThemeRendererInterface instance | 70 |
| public static | ''handleFrontHelper()'' | handleFrontHelper | 86 |
| public static | ''findRequestToRules()'' | findRequestToRules | 104 |
| private static | ''findRequestToPath()'' | findRequestToPath() | 134 |
| private static | ''isRequestToPathValid()'' | isRequestToPathValid() | 166 |
| public static | ''isMatchedUriRequested()'' | isMatchedUriRequested() | 187 |
| public static | ''isQueryStringRequested()'' | isQueryStringRequested() | 204 |
| public static | ''checkMatchUriRequested()'' | checkMatchUriRequested() | 226 |
| public static | ''allowedPathRequested()'' | allowedPathRequested | 247 |
| private static | ''renderTemplate()'' | renderTemplate | 269 |
| private static | ''deliverQuerySearch()'' | deliverQuerySearch | 293 |
| private static | ''handleDownloadRequest()'' | handleDownloadRequest | 333 |
| private static | ''handlePathBasedDownload()'' | handlePathBasedDownload | 356 |
| private static | ''getDownloadController()'' | (undocumented) | 382 |
| public static | ''deliverQueryString()'' | deliverQueryString | 398 |
| private static | ''deliverQueryPost()'' | deliverQueryPost | 450 |
| private static | ''deliverQueryCategory()'' | deliverQueryCategory | 473 |
| private static | ''deliverQueryPage()'' | deliverQueryPage | 496 |
| private static | ''deliverQueryArchive()'' | deliverQueryArchive | 519 |
| private static | ''deliverQueryTag()'' | deliverQueryTag | 535 |
| private static | ''deliverQueryDownload()'' | deliverQueryDownload | 551 |
| private static | ''deliverDefaultQuery()'' | deliverDefaultQuery | 569 |
======== setThemeRenderer() ========
public static function setThemeRenderer(?ThemeRendererInterface $renderer): void
//lines 70–73 (4)//
Set the ThemeRendererInterface instance
^ Parameter ^ Type ^ Default ^ Description ^
| ''$renderer'' | [[scriptlog:lib:core:themerendererinterface|''?ThemeRendererInterface'']] | //required// | //none// |
**Returns:** ''void''
======== handleFrontHelper() ========
public static function handleFrontHelper()
//lines 86–91 (6)//
handleFrontHelper
Resolve the shared FrontService instance from the global registry.
Returns null when the service has not been registered so callers can
fail safely. The FrontHelper static facade is deprecated; front-end
content is now accessed through this service.
//Takes no parameters.//
**Returns:** ''(none declared)'' — FrontService|null
======== findRequestToRules() ========
public static function findRequestToRules($rules)
//lines 104–122 (19)//
findRequestToRules
Match the current request URI against a list of route patterns and
return the first match's captured parameters.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$rules'' | ''(untyped)'' | //required// | List of route regex patterns. |
**Returns:** ''(none declared)'' — array The captured matches for the first matching rule, or an empty array when no rule matches.
======== findRequestToPath() ========
private static function findRequestToPath()
//lines 134–156 (23)//
findRequestToPath()
Resolve the raw request path (query string stripped) once per request
and cache the result so repeat callers do no redundant work.
//Takes no parameters.//
**Returns:** ''(none declared)'' — string The request path without leading/trailing slashes, or a directory separator for the site root.
======== isRequestToPathValid() ========
private static function isRequestToPathValid($args)
//lines 166–176 (11)//
isRequestToPathValid()
^ Parameter ^ Type ^ Default ^ Description ^
| ''$args'' | ''(untyped)'' | //required// | Zero-based segment index into the request path. |
**Returns:** ''(none declared)'' — string|boolean The basename of the requested segment, or false when the segment does not exist.
======== isMatchedUriRequested() ========
public static function isMatchedUriRequested()
//lines 187–192 (6)//
isMatchedUriRequested()
Return the first path segment of the requested URI.
//Takes no parameters.//
**Returns:** ''(none declared)'' — string The first segment, or an empty string when no request URI is present.
======== isQueryStringRequested() ========
public static function isQueryStringRequested()
//lines 204–215 (12)//
isQueryStringRequested()
Parse the query string into a ['key' => ..., 'value' => ...] pair. The
result is computed once per request and cached for all subsequent
callers (templates, permalink helpers and theme utilities).
//Takes no parameters.//
**Returns:** ''(none declared)'' — array Associative array with 'key' and 'value' entries.
======== checkMatchUriRequested() ========
public static function checkMatchUriRequested()
//lines 226–235 (10)//
checkMatchUriRequested()
Compare the first URI segment with the first sanitized RequestPath
segment to detect a canonical (matching) request.
//Takes no parameters.//
**Returns:** ''(none declared)'' — bool True when both segments are identical, false otherwise.
======== allowedPathRequested() ========
public static function allowedPathRequested($path)
//lines 247–258 (12)//
allowedPathRequested
Check whether the first path segment of the request URI is present in
the whitelist, or the request targets the site root.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$path'' | ''(untyped)'' | //required// | Whitelist of allowed first path segments. |
**Returns:** ''(none declared)'' — bool True when the request may proceed, false otherwise.
======== renderTemplate() ========
private static function renderTemplate($template, $statusCode = 200)
//lines 269–284 (16)//
renderTemplate
Render a template through the injected ThemeRenderer, or fall back to
the legacy global theme functions when no renderer is available.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''(untyped)'' | //required// | Template name (without .php extension). |
| ''$statusCode'' | ''(untyped)'' | ''200'' | HTTP status code used by the legacy fallback. |
**Returns:** ''(none declared)''
======== deliverQuerySearch() ========
private static function deliverQuerySearch()
//lines 293–322 (30)//
deliverQuerySearch
Render the search template. When the keyword is too short the search
globals are emptied; otherwise a SearchFinder query is run and its
results exposed through $GLOBALS for the theme template.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== handleDownloadRequest() ========
private static function handleDownloadRequest($identifier)
//lines 333–343 (11)//
handleDownloadRequest
Dispatch a download request read from the query string. When the
request URI also contains a '/file' segment the download controller
streams the file; otherwise the download landing page is rendered.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$identifier'' | ''(untyped)'' | //required// | Download identifier (UUID). |
**Returns:** ''(none declared)''
======== handlePathBasedDownload() ========
private static function handlePathBasedDownload($firstSegment)
//lines 356–380 (25)//
handlePathBasedDownload
Handle '/download/{identifier}' style paths when permalinks are
disabled. Renders the download landing page or streams the file for
an additional '/file' path segment.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$firstSegment'' | ''(untyped)'' | //required// | First path segment of the request. |
**Returns:** ''(none declared)'' — bool True when the request was handled as a download, false otherwise so the caller can continue dispatching.
======== getDownloadController() ========
private static function getDownloadController()
//lines 382–389 (8)//
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryString() ========
public static function deliverQueryString()
//lines 398–443 (46)//
deliverQueryString
Dispatch a query-string request to its handler, its dedicated delivery
method, or the default (home) renderer.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryPost() ========
private static function deliverQueryPost()
//lines 450–466 (17)//
deliverQueryPost
Render a single post from the 'p' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryCategory() ========
private static function deliverQueryCategory()
//lines 473–489 (17)//
deliverQueryCategory
Render a category archive from the 'cat' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryPage() ========
private static function deliverQueryPage()
//lines 496–512 (17)//
deliverQueryPage
Render a static page from the 'pg' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryArchive() ========
private static function deliverQueryArchive()
//lines 519–528 (10)//
deliverQueryArchive
Render the monthly archive from the 'a' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryTag() ========
private static function deliverQueryTag()
//lines 535–544 (10)//
deliverQueryTag
Render the tag archive from the 'tag' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverQueryDownload() ========
private static function deliverQueryDownload()
//lines 551–560 (10)//
deliverQueryDownload
Dispatch a download request from the 'download' query-string key.
//Takes no parameters.//
**Returns:** ''(none declared)''
======== deliverDefaultQuery() ========
private static function deliverDefaultQuery()
//lines 569–594 (26)//
deliverDefaultQuery
Fallback dispatch for requests without a recognized query-string key.
Renders the home template for the root, whitelisted legacy entry
points and matched URIs; otherwise renders a 404.
//Takes no parameters.//
**Returns:** ''(none declared)''
======= Imports =======
^ Alias ^ Fully-qualified name ^
| ''DownloadController'' | [[scriptlog:lib:controller:downloadcontroller|''Scriptlog\Controller\DownloadController'']] |
| ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] |
| ''HandlerRegistry'' | [[scriptlog:lib:handler:handlerregistry|''Scriptlog\Handler\HandlerRegistry'']] |
| ''DownloadModel'' | [[scriptlog:lib:model:downloadmodel|''Scriptlog\Model\DownloadModel'']] |
| ''DownloadService'' | [[scriptlog:lib:service:downloadservice|''Scriptlog\Service\DownloadService'']] |
| ''FrontService'' | [[scriptlog:lib:service:frontservice|''Scriptlog\Service\FrontService'']] |
----
//This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//