====== Dispatcher ======
**Layer:** ''Core'' · **Source:** ''lib/core/Dispatcher.php:34'' (lines 34–535)
----
class Dispatcher
======= Docblock Metadata =======
^ Tag ^ Value ^
| ''@category'' | Core Class |
| ''@author'' | M.Noermoehammad |
| ''@license'' | MIT |
| ''@version'' | 1.1.2 |
| ''@since'' | Since Release 0.1 |
| ''@see'' | https://stackoverflow.com/questions/11696718/htaccess-rewrite-book-phpid-1234-to-book-1234 |
| ''@see'' | https://stackoverflow.com/questions/1039725/how-to-do-url-re-writing-in-php |
| ''@see'' | https://stackoverflow.com/questions/60339372/how-to-rewrite-url-by-htaccess-with-basic-parameters-in-core-php |
| ''@see'' | https://httpd.apache.org/docs/trunk/mod/mod_dir.html#fallbackresource |
| ''@see'' | https://stackoverflow.com/questions/26419426/htaccess-url-re-styling-image-url-to-seo-friendly |
| ''@see'' | https://mediatemple.net/community/products/dv/204643270/using-htaccess-rewrite-rules |
| ''@see'' | https://stackoverflow.com/questions/16388959/url-rewriting-with-php |
======= Inheritance =======
//No parent, interface or trait. This is a root type.//
======= Constants (0) =======
//None.//
======= Properties (4) =======
^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''(untyped)'' | ''$route'' | ''[]'' | 42 |
| ''private'' | ''(untyped)'' | ''$frontendCompiled'' | ''null'' | 47 |
| ''private'' | ''(untyped)'' | ''$theme_dir'' | | 55 |
| ''private'' | [[scriptlog:lib:core:themerendererinterface|''?ThemeRendererInterface'']] | ''$themeRenderer'' | ''null'' | 62 |
======= Methods (19) =======
^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | Constructor | 68 |
| public | ''dispatch()'' | dispatch | 84 |
| public | ''handleSeoFriendlyUrl()'' | handleSeoFriendlyUrl | 98 |
| private | ''validateContentExists()'' | Validate content exists in database | 204 |
| private | ''validateSinglePost()'' | (undocumented) | 228 |
| private | ''validatePage()'' | (undocumented) | 248 |
| private | ''validateCategory()'' | (undocumented) | 267 |
| private | ''validateArchive()'' | (undocumented) | 278 |
| private | ''validateTag()'' | (undocumented) | 297 |
| private | ''handleQueryDownload()'' | (undocumented) | 308 |
| private | ''handleQueryStringUrl()'' | handleQueryStringUrl | 336 |
| private | ''requestURI()'' | RequestURI() | 349 |
| private | ''invokeTheme()'' | (undocumented) | 375 |
| private | ''renderTheme()'' | renderTheme | 386 |
| private | ''renderHtmxFragment()'' | Render HTMX fragment — just the content template, no header/footer. | 408 |
| private | ''compileFrontendRoutes()'' | Compile all frontend routes into a combined (?|...) branch-reset regex. | 433 |
| private | ''renderDownloadFile()'' | renderDownloadFile | 477 |
| private | ''errorNotFound()'' | (undocumented) | 494 |
| private | ''whiteListPathRequested()'' | Get whitelisted paths | 509 |
======== __construct() ========
public function __construct(?ThemeRendererInterface $themeRenderer = null)
//lines 68–78 (11)//
Constructor
Registry route and Initialize an instantiate of theme
^ Parameter ^ Type ^ Default ^ Description ^
| ''$themeRenderer'' | [[scriptlog:lib:core:themerendererinterface|''?ThemeRendererInterface'']] | ''null'' | //none// |
======== dispatch() ========
public function dispatch()
//lines 84–92 (9)//
//Takes no parameters.//
**Returns:** ''(none declared)''
======== handleSeoFriendlyUrl() ========
public function handleSeoFriendlyUrl()
//lines 98–195 (98)//
handleSeoFriendlyUrl
//Takes no parameters.//
**Returns:** ''(none declared)''
======== validateContentExists() ========
private function validateContentExists($routeKey, $requestPath)
//lines 204–226 (23)//
Validate content exists in database
^ Parameter ^ Type ^ Default ^ Description ^
| ''$routeKey'' | ''(untyped)'' | //required// | //none// |
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)'' — bool
======== validateSinglePost() ========
private function validateSinglePost($requestPath)
//lines 228–246 (19)//
^ Parameter ^ Type ^ Default ^ Description ^
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== validatePage() ========
private function validatePage($requestPath)
//lines 248–265 (18)//
^ Parameter ^ Type ^ Default ^ Description ^
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== validateCategory() ========
private function validateCategory($requestPath)
//lines 267–276 (10)//
^ Parameter ^ Type ^ Default ^ Description ^
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== validateArchive() ========
private function validateArchive($requestPath)
//lines 278–295 (18)//
^ Parameter ^ Type ^ Default ^ Description ^
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== validateTag() ========
private function validateTag($requestPath)
//lines 297–306 (10)//
^ Parameter ^ Type ^ Default ^ Description ^
| ''$requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== handleQueryDownload() ========
private function handleQueryDownload()
//lines 308–330 (23)//
//Takes no parameters.//
**Returns:** ''(none declared)''
======== handleQueryStringUrl() ========
private function handleQueryStringUrl()
//lines 336–341 (6)//
handleQueryStringUrl
//Takes no parameters.//
**Returns:** ''(none declared)''
======== requestURI() ========
private function requestURI()
//lines 349–367 (19)//
RequestURI()
//Takes no parameters.//
**Returns:** ''(none declared)'' — mixed
======== invokeTheme() ========
private function invokeTheme()
//lines 375–378 (4)//
//Takes no parameters.//
**Returns:** ''(none declared)''
======== renderTheme() ========
private function renderTheme($template)
//lines 386–401 (16)//
renderTheme
^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== renderHtmxFragment() ========
private function renderHtmxFragment($template)
//lines 408–422 (15)//
Render HTMX fragment — just the content template, no header/footer.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== compileFrontendRoutes() ========
private function compileFrontendRoutes()
//lines 433–467 (35)//
Compile all frontend routes into a combined (?|...) branch-reset regex.
Converts Perl-style (?'name'...) named groups to numbered groups for
the combined regex, while preserving the original pattern for the
per-route verification phase. With ~13 routes, no chunking is needed.
//Takes no parameters.//
**Returns:** ''(none declared)'' — array
======== renderDownloadFile() ========
private function renderDownloadFile($_requestPath)
//lines 477–485 (9)//
renderDownloadFile
Handles actual file download - bypasses theme headers/footers
^ Parameter ^ Type ^ Default ^ Description ^
| ''$_requestPath'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== errorNotFound() ========
private function errorNotFound()
//lines 494–504 (11)//
//Takes no parameters.//
**Returns:** ''(none declared)''
======== whiteListPathRequested() ========
private function whiteListPathRequested()
//lines 509–534 (26)//
Get whitelisted paths
//Takes no parameters.//
**Returns:** ''(none declared)''
======= Imports =======
^ Alias ^ Fully-qualified name ^
| ''DownloadController'' | [[scriptlog:lib:controller:downloadcontroller|''Scriptlog\Controller\DownloadController'']] |
| ''LocaleController'' | [[scriptlog:lib:controller:localecontroller|''Scriptlog\Controller\LocaleController'']] |
| ''SearchController'' | [[scriptlog:lib:controller:searchcontroller|''Scriptlog\Controller\SearchController'']] |
| ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] |
| ''DownloadModel'' | [[scriptlog:lib:model:downloadmodel|''Scriptlog\Model\DownloadModel'']] |
| ''DownloadService'' | [[scriptlog:lib:service:downloadservice|''Scriptlog\Service\DownloadService'']] |
----
//This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//