| Next revision | Previous revision |
| scriptlog:lib:service:frontservice [2026/09/26 09:09] – admin admin | scriptlog:lib:service:frontservice [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Service | | | ''@category'' | Service | |
| | ''@author'' | System | | | ''@author'' | System | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| //None.// | //None.// |
| |
| ======= Properties (0) ======= | ======= Properties (6) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''private'' | [[scriptlog:lib:dao:postdao|''?PostDao'']] | ''$postDao'' | | 50 | |
| | | ''private'' | [[scriptlog:lib:dao:pagedao|''?PageDao'']] | ''$pageDao'' | | 57 | |
| | | ''private'' | [[scriptlog:lib:dao:topicdao|''?TopicDao'']] | ''$topicDao'' | | 64 | |
| | | ''private'' | [[scriptlog:lib:dao:mediadao|''?MediaDao'']] | ''$mediaDao'' | | 71 | |
| | | ''private'' | ''bool'' | ''$hasSanitizer'' | | 78 | |
| | | ''private'' | [[scriptlog:lib:core:sanitize|''?Sanitize'']] | ''$sanitizer'' | | 85 | |
| |
| ======= Methods (13) ======= | ======= Methods (13) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Construct a new FrontService. | 98 | | | public | ''__construct()'' | Construct a new FrontService. | 98 | |
| | public | ''getPublishedPost()'' | Retrieve a published post by ID, including author and media metadata. | 122 | | | public | ''getPublishedPost()'' | Retrieve a published post by ID, including author and media metadata. | 122 | |
| | public | ''getPublishedPage()'' | Retrieve a published page by its slug. | 178 | | | public | ''getPublishedPage()'' | Retrieve a published page by its slug. | 178 | |
| | public | ''getPublishedTopic()'' | Retrieve a published topic/category by its slug. | 253 | | | public | ''getPublishedTopic()'' | Retrieve a published topic/category by its slug. | 253 | |
| | public | ''getPublishedTopicById()'' | Retrieve a published topic/category by its ID. | 291 | | | public | ''getPublishedTopicById()'' | Retrieve a published topic/category by its ID. | 291 | |
| | public | ''getSimplePost()'' | Retrieve a simple post by ID (basic fields, no archive columns). | 325 | | | public | ''getSimplePost()'' | Retrieve a simple post by ID (basic fields, no archive columns). | 325 | |
| | public | ''getSimpleTopic()'' | Retrieve a simple topic/category by ID. | 368 | | | public | ''getSimpleTopic()'' | Retrieve a simple topic/category by ID. | 368 | |
| | public | ''getSimplePage()'' | Retrieve a simple page by ID. | 395 | | | public | ''getSimplePage()'' | Retrieve a simple page by ID. | 395 | |
| | public | ''getSimpleArchive()'' | Retrieve archive index (all years/months with published blog posts). | 437 | | | public | ''getSimpleArchive()'' | Retrieve archive index (all years/months with published blog posts). | 437 | |
| | public | ''searchTag()'' | Search for a tag in published blog posts. | 466 | | | public | ''searchTag()'' | Search for a tag in published blog posts. | 466 | |
| | public | ''getTagLists()'' | Retrieve a list of all unique, trimmed tags across published posts. | 501 | | | public | ''getTagLists()'' | Retrieve a list of all unique, trimmed tags across published posts. | 501 | |
| | public | ''getArchivePosts()'' | Retrieve published posts for a specific archive month/year. | 537 | | | public | ''getArchivePosts()'' | Retrieve published posts for a specific archive month/year. | 537 | |
| | public | ''getGalleries()'' | Retrieve gallery images (media targeted as 'gallery'). | 589 | | | public | ''getGalleries()'' | Retrieve gallery images (media targeted as 'gallery'). | 589 | |
| |
| |
| resolved from the global Registry at construction time. | resolved from the global Registry at construction time. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$postDao'' | ''(untyped)'' | ''null'' | Optional post DAO. | | | ''$postDao'' | ''(untyped)'' | ''null'' | Optional post DAO. | |
| | ''$pageDao'' | ''(untyped)'' | ''null'' | Optional page DAO. | | | ''$pageDao'' | ''(untyped)'' | ''null'' | Optional page DAO. | |
| | ''$topicDao'' | ''(untyped)'' | ''null'' | Optional topic DAO. | | | ''$topicDao'' | ''(untyped)'' | ''null'' | Optional topic DAO. | |
| | ''$mediaDao'' | ''(untyped)'' | ''null'' | Optional media DAO. | | | ''$mediaDao'' | ''(untyped)'' | ''null'' | Optional media DAO. | |
| |
| |
| connection is unavailable. | connection is unavailable. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The post identifier. | | | ''$id'' | ''int'' | //required// | The post identifier. | |
| |
| **Returns:** ''?array'' — array|null Post data with user and media information, or null. | **Returns:** ''?array'' — array|null Post data with user and media information, or null. |
| prepared JOIN query via the shared database connection. | prepared JOIN query via the shared database connection. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$slug'' | ''string'' | //required// | The page slug. | | | ''$slug'' | ''string'' | //required// | The page slug. | |
| |
| **Returns:** ''?array'' — array|null Page data with author and media information, or null. | **Returns:** ''?array'' — array|null Page data with author and media information, or null. |
| and iterating (avoids O(n) scan). | and iterating (avoids O(n) scan). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$slug'' | ''string'' | //required// | The topic slug. | | | ''$slug'' | ''string'' | //required// | The topic slug. | |
| |
| **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. | **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. |
| Retrieve a published topic/category by its ID. | Retrieve a published topic/category by its ID. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''int'' | //required// | The topic identifier. | | | ''$id'' | ''int'' | //required// | The topic identifier. | |
| |
| **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. | **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. |
| Legacy method matching FrontHelper::grabSimpleFrontPost(). | Legacy method matching FrontHelper::grabSimpleFrontPost(). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''(untyped)'' | //required// | The post identifier. | | | ''$id'' | ''(untyped)'' | //required// | The post identifier. | |
| |
| **Returns:** ''?array'' — array|null Post data or null. | **Returns:** ''?array'' — array|null Post data or null. |
| Legacy method matching FrontHelper::grabSimpleFrontTopic(). | Legacy method matching FrontHelper::grabSimpleFrontTopic(). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''(untyped)'' | //required// | The topic identifier. | | | ''$id'' | ''(untyped)'' | //required// | The topic identifier. | |
| |
| **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. | **Returns:** ''?array'' — array|null Topic data (ID, topic_title, topic_slug) or null. |
| Legacy method matching FrontHelper::grabSimpleFrontPage(). | Legacy method matching FrontHelper::grabSimpleFrontPage(). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''(untyped)'' | //required// | The page identifier. | | | ''$id'' | ''(untyped)'' | //required// | The page identifier. | |
| |
| **Returns:** ''?array'' — array|null Page data or null. | **Returns:** ''?array'' — array|null Page data or null. |
| Uses a LIKE query against the post_tags column. | Uses a LIKE query against the post_tags column. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$tag'' | ''string'' | //required// | The tag keyword to search for. | | | ''$tag'' | ''string'' | //required// | The tag keyword to search for. | |
| |
| **Returns:** ''array'' — array Matching post data, or an empty array when not found. | **Returns:** ''array'' — array Matching post data, or an empty array when not found. |
| Legacy method matching FrontHelper::grabPreparedFrontArchive(). | Legacy method matching FrontHelper::grabPreparedFrontArchive(). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$values'' | ''array'' | //required// | Associative array with 'month' and 'year' keys. | | | ''$values'' | ''array'' | //required// | Associative array with 'month' and 'year' keys. | |
| |
| **Returns:** ''?array'' — array|null Post data for the archive month, or null. | **Returns:** ''?array'' — array|null Post data for the archive month, or null. |
| original FrontHelper::grabPreparedFrontGalleries() behaviour. | original FrontHelper::grabPreparedFrontGalleries() behaviour. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$start'' | ''int'' | //required// | Offset for pagination. | | | ''$start'' | ''int'' | //required// | Offset for pagination. | |
| | ''$limit'' | ''int'' | //required// | Maximum number of rows to query. | | | ''$limit'' | ''int'' | //required// | Maximum number of rows to query. | |
| |
| **Returns:** ''?array'' — array|null Single gallery row with media_filename, media_caption, media_id; or null. | **Returns:** ''?array'' — array|null Single gallery row with media_filename, media_caption, media_id; or null. |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''Registry'' | [[scriptlog:lib:core:registry|''Scriptlog\Core\Registry'']] | | | ''Registry'' | [[scriptlog:lib:core:registry|''Scriptlog\Core\Registry'']] | |
| | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | | | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | |
| | ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] | | | ''MediaDao'' | [[scriptlog:lib:dao:mediadao|''Scriptlog\Dao\MediaDao'']] | |
| | ''PageDao'' | [[scriptlog:lib:dao:pagedao|''Scriptlog\Dao\PageDao'']] | | | ''PageDao'' | [[scriptlog:lib:dao:pagedao|''Scriptlog\Dao\PageDao'']] | |
| | ''PostDao'' | [[scriptlog:lib:dao:postdao|''Scriptlog\Dao\PostDao'']] | | | ''PostDao'' | [[scriptlog:lib:dao:postdao|''Scriptlog\Dao\PostDao'']] | |
| | ''TopicDao'' | [[scriptlog:lib:dao:topicdao|''Scriptlog\Dao\TopicDao'']] | | | ''TopicDao'' | [[scriptlog:lib:dao:topicdao|''Scriptlog\Dao\TopicDao'']] | |
| |
| |