This is an old revision of the document!
Table of Contents
ThemeService
Layer: Service · Source: lib/service/ThemeService.php:23 (lines 23–467)
class ThemeService
Docblock Metadata
| Tag | Value |
|---|---|
@category | Class ThemeService |
@author | M.Noermoehammad |
@license | MIT |
@version | 1.0.0 |
@since | Since Release 1.0.0 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (18)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public | __construct() | Constructor | 94 |
| public | setThemeId() | Set Theme ID | 107 |
| public | setThemeTitle() | Set Theme Title | 117 |
| public | setThemeDescription() | Set Theme Description | 127 |
| public | setThemeDesigner() | Set Theme Designer | 137 |
| public | setThemeDirectory() | Set Theme Directory | 147 |
| public | setThemeStatus() | Set Theme Status | 157 |
| public | grabThemes() | Retrieve themes | 168 |
| public | grabTheme() | Retrieve a single theme | 179 |
| public | addTheme() | Add a new theme | 188 |
| public | modifyTheme() | Modify an existing theme | 206 |
| public | activateInstalledTheme() | Activate an installed theme | 235 |
| public | activateInstalledThemeWithLicense() | Activate an installed theme, validating the license key first. | 251 |
| public | deactivateInstalledTheme() | Deactivate an installed theme | 360 |
| private | deactivateThemeLicense() | Notify the MyBlog license server that a premium theme is being | 384 |
| public | removeTheme() | Remove a theme | 427 |
| public | isThemeExists() | isThemeExists | 452 |
| public | totalThemes() | totalThemes | 463 |
__construct()
public function __construct(ThemeDao $themeDao, FormValidator $validator, Sanitize $sanitize)
lines 94–100 (7)
Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
$themeDao | ''ThemeDao'' | required | none |
$validator | ''FormValidator'' | required | none |
$sanitize | ''Sanitize'' | required | none |
setThemeId()
public function setThemeId($theme_id)
lines 107–110 (4)
Set Theme ID
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_id | (untyped) | required | none |
Returns: (none declared)
setThemeTitle()
public function setThemeTitle($theme_title)
lines 117–120 (4)
Set Theme Title
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_title | (untyped) | required | none |
Returns: (none declared)
setThemeDescription()
public function setThemeDescription($theme_description)
lines 127–130 (4)
Set Theme Description
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_description | (untyped) | required | none |
Returns: (none declared)
setThemeDesigner()
public function setThemeDesigner($theme_designer)
lines 137–140 (4)
Set Theme Designer
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_designer | (untyped) | required | none |
Returns: (none declared)
setThemeDirectory()
public function setThemeDirectory($theme_directory)
lines 147–150 (4)
Set Theme Directory
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_directory | (untyped) | required | none |
Returns: (none declared)
setThemeStatus()
public function setThemeStatus($theme_status)
lines 157–160 (4)
Set Theme Status
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_status | (untyped) | required | none |
Returns: (none declared)
grabThemes()
public function grabThemes($orderBy = 'ID')
lines 168–171 (4)
Retrieve themes
| Parameter | Type | Default | Description |
|---|---|---|---|
$orderBy | (untyped) | 'ID' | Column to order by |
Returns: (none declared) — array
grabTheme()
public function grabTheme($id)
lines 179–182 (4)
Retrieve a single theme
| Parameter | Type | Default | Description |
|---|---|---|---|
$id | (untyped) | required | none |
Returns: (none declared) — array
addTheme()
public function addTheme()
lines 188–200 (13)
Add a new theme
Takes no parameters.
Returns: (none declared)
modifyTheme()
public function modifyTheme()
lines 206–229 (24)
Modify an existing theme
Takes no parameters.
Returns: (none declared)
activateInstalledTheme()
public function activateInstalledTheme()
lines 235–239 (5)
Activate an installed theme
Takes no parameters.
Returns: (none declared)
activateInstalledThemeWithLicense()
public function activateInstalledThemeWithLicense($licenseKey = null)
lines 251–354 (104)
Activate an installed theme, validating the license key first.
Free themes activate immediately without a license key. Premium themes require a valid license key that is checked against the MyBlog license API before activation is allowed.
| Parameter | Type | Default | Description |
|---|---|---|---|
$licenseKey | (untyped) | null | none |
Returns: (none declared) — array{success: bool, message: string}
deactivateInstalledTheme()
public function deactivateInstalledTheme()
lines 360–371 (12)
Deactivate an installed theme
Takes no parameters.
Returns: (none declared)
deactivateThemeLicense()
private function deactivateThemeLicense($theme)
lines 384–420 (37)
Notify the MyBlog license server that a premium theme is being
deactivated, releasing one activation slot for the license key.
Runs best-effort: failures are swallowed so the admin can still deactivate the theme locally. Only premium themes with a stored license key and product identifier trigger a remote call.
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme | (untyped) | required | none |
Returns: (none declared) — void
removeTheme()
public function removeTheme()
lines 427–444 (18)
Remove a theme
Takes no parameters.
Returns: (none declared) — bool
isThemeExists()
public function isThemeExists($theme_title)
lines 452–455 (4)
isThemeExists
| Parameter | Type | Default | Description |
|---|---|---|---|
$theme_title | (untyped) | required | none |
Returns: (none declared) — boolean
totalThemes()
public function totalThemes(array $data = []): ?int
lines 463–466 (4)
totalThemes
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | [] | none |
Returns: ?int — integer|numeric|null
Imports
| Alias | Fully-qualified name |
|---|---|
FormValidator | ''Scriptlog\Core\FormValidator'' |
Sanitize | ''Scriptlog\Core\Sanitize'' |
ThemeDao | ''Scriptlog\Dao\ThemeDao'' |
ThemeLicenseService | ''Scriptlog\Service\ThemeLicenseService'' |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
