| Next revision | Previous revision |
| scriptlog:lib:service:themelicenseservice [2026/09/26 09:09] – admin admin | scriptlog:lib:service:themelicenseservice [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Class ThemeLicenseService | | | ''@category'' | Class ThemeLicenseService | |
| | ''@author'' | MyBlog | | | ''@author'' | MyBlog | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0.0 | | | ''@version'' | 1.0.0 | |
| | ''@since'' | Since Release 1.0.0 | | | ''@since'' | Since Release 1.0.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| //None.// | //None.// |
| |
| ======= Properties (0) ======= | ======= Properties (2) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''protected'' | ''(untyped)'' | ''$apiBaseUrl'' | | 28 | |
| | | ''private'' | ''(untyped)'' | ''$timeout'' | | 35 | |
| |
| ======= Methods (10) ======= | ======= Methods (10) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Constructor | 43 | | | public | ''__construct()'' | Constructor | 43 | |
| | public | ''readThemeConfig()'' | Read the theme.ini configuration for a given theme directory. | 55 | | | public | ''readThemeConfig()'' | Read the theme.ini configuration for a given theme directory. | 55 | |
| | public | ''isPremiumTheme()'' | Determine whether a theme is a premium theme. | 74 | | | public | ''isPremiumTheme()'' | Determine whether a theme is a premium theme. | 74 | |
| | public | ''activate()'' | Activate a license key against the MyBlog license API. | 97 | | | public | ''activate()'' | Activate a license key against the MyBlog license API. | 97 | |
| | public | ''validate()'' | Validate an already-activated license. | 120 | | | public | ''validate()'' | Validate an already-activated license. | 120 | |
| | public | ''deactivate()'' | Deactivate a theme license, releasing one activation slot. | 143 | | | public | ''deactivate()'' | Deactivate a theme license, releasing one activation slot. | 143 | |
| | protected | ''post()'' | Send an HMAC-signed POST request to the license API. | 167 | | | protected | ''post()'' | Send an HMAC-signed POST request to the license API. | 167 | |
| | private | ''postCurl()'' | Send the request using cURL. | 198 | | | private | ''postCurl()'' | Send the request using cURL. | 198 | |
| | private | ''postStream()'' | Send the request using stream context (fallback when cURL is absent). | 234 | | | private | ''postStream()'' | Send the request using stream context (fallback when cURL is absent). | 234 | |
| | protected | ''parseResponse()'' | Parse the JSON response from the license API. | 278 | | | protected | ''parseResponse()'' | Parse the JSON response from the license API. | 278 | |
| |
| |
| Constructor | Constructor |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$apiBaseUrl'' | ''(untyped)'' | ''null'' | Override the license API base URL. | | | ''$apiBaseUrl'' | ''(untyped)'' | ''null'' | Override the license API base URL. | |
| | ''$timeout'' | ''(untyped)'' | ''10'' | Request timeout in seconds. | | | ''$timeout'' | ''(untyped)'' | ''10'' | Request timeout in seconds. | |
| |
| |
| Read the theme.ini configuration for a given theme directory. | Read the theme.ini configuration for a given theme directory. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$themeDirectory'' | ''(untyped)'' | //required// | //none// | | | ''$themeDirectory'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Determine whether a theme is a premium theme. | Determine whether a theme is a premium theme. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$themeDirectory'' | ''(untyped)'' | //required// | //none// | | | ''$themeDirectory'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Body: {"license_key": "...", "domain": "..."} | Body: {"license_key": "...", "domain": "..."} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$licenseKey'' | ''(untyped)'' | //required// | The license key entered by the admin. | | | ''$licenseKey'' | ''(untyped)'' | //required// | The license key entered by the admin. | |
| | ''$domain'' | ''(untyped)'' | //required// | The domain where the theme is installed. | | | ''$domain'' | ''(untyped)'' | //required// | The domain where the theme is installed. | |
| | ''$productSecret'' | ''(untyped)'' | //required// | Per-product license_secret embedded in the theme. | | | ''$productSecret'' | ''(untyped)'' | //required// | Per-product license_secret embedded in the theme. | |
| | ''$productId'' | ''(untyped)'' | //required// | MyBlog store product ID for this theme. | | | ''$productId'' | ''(untyped)'' | //required// | MyBlog store product ID for this theme. | |
| |
| **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} | **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} |
| Body: {"license_key": "...", "product_id": N} | Body: {"license_key": "...", "product_id": N} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$licenseKey'' | ''(untyped)'' | //required// | //none// | | | ''$licenseKey'' | ''(untyped)'' | //required// | //none// | |
| | ''$productId'' | ''(untyped)'' | //required// | //none// | | | ''$productId'' | ''(untyped)'' | //required// | //none// | |
| | ''$productSecret'' | ''(untyped)'' | //required// | //none// | | | ''$productSecret'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} | **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} |
| Body: {"license_key": "...", "product_id": N} | Body: {"license_key": "...", "product_id": N} |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$licenseKey'' | ''(untyped)'' | //required// | //none// | | | ''$licenseKey'' | ''(untyped)'' | //required// | //none// | |
| | ''$productId'' | ''(untyped)'' | //required// | //none// | | | ''$productId'' | ''(untyped)'' | //required// | //none// | |
| | ''$productSecret'' | ''(untyped)'' | //required// | //none// | | | ''$productSecret'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} | **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} |
| signature = hash_hmac('sha256', payload, secret) | signature = hash_hmac('sha256', payload, secret) |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$url'' | ''(untyped)'' | //required// | //none// | | | ''$url'' | ''(untyped)'' | //required// | //none// | |
| | ''$body'' | ''(untyped)'' | //required// | //none// | | | ''$body'' | ''(untyped)'' | //required// | //none// | |
| | ''$secret'' | ''(untyped)'' | //required// | //none// | | | ''$secret'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} | **Returns:** ''(none declared)'' — array{success: bool, message: string, data?: array} |
| Send the request using cURL. | Send the request using cURL. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$url'' | ''(untyped)'' | //required// | //none// | | | ''$url'' | ''(untyped)'' | //required// | //none// | |
| | ''$body'' | ''(untyped)'' | //required// | //none// | | | ''$body'' | ''(untyped)'' | //required// | //none// | |
| | ''$headers'' | ''array'' | //required// | //none// | | | ''$headers'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Send the request using stream context (fallback when cURL is absent). | Send the request using stream context (fallback when cURL is absent). |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$url'' | ''(untyped)'' | //required// | //none// | | | ''$url'' | ''(untyped)'' | //required// | //none// | |
| | ''$body'' | ''(untyped)'' | //required// | //none// | | | ''$body'' | ''(untyped)'' | //required// | //none// | |
| | ''$headers'' | ''array'' | //required// | //none// | | | ''$headers'' | ''array'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Parse the JSON response from the license API. | Parse the JSON response from the license API. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$response'' | ''(untyped)'' | //required// | //none// | | | ''$response'' | ''(untyped)'' | //required// | //none// | |
| | ''$httpCode'' | ''(untyped)'' | //required// | //none// | | | ''$httpCode'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |