API Documentation
Table of Contents
Namespaces
Constants
- ALLOWED_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg']
- Allowed file extensions for uploads
- APP_NAME = 'core'
- CACHE_DRIVER = 'file'
- CACHE_ENABLED = \false
- CACHE_ENCRYPTION_CIPHER = 'aes-256-cbc'
- CACHE_ENCRYPTION_ENABLED = \true
- CACHE_ENCRYPTION_KEY = 'change-this-to-a-very-secret-and-long-key'
- CACHE_MAX_SIZE_PER_ELEMENT = 65536
- CACHE_PATH = '/dev/shm/'
- DressAPI
- CORE_PATH = \CORE_SRC_PATH . '/modules/base'
- CORE_SRC_PATH = \dirname(__DIR__, 2)
- Base path to the core modules directory Path: core/src/api/components -> core/src/api -> core/src
- DEFAULT_VIEW = 'bi5'
- Default view folder for components
- DOMAIN_NAME = 'dressapi'
- GALLERY_ROOT = \dirname(__DIR__, 4) . '/public-files'
- Root directory for gallery files storage Shared location: /var/vhosts/dressapi/public-files
- ITEM_ID = 'id'
- MAIL_DEBUG = false
- MAIL_ENCRYPTION = \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS
- MAIL_PORT = 465
- MAIL_SMTP_PROTOCOL = true
- MAX_LEVEL_FOLDERS = 20
- MAX_UPLOAD_SIZE = 10 * 1024 * 1024
- Maximum file upload size in bytes (10MB)
- OCI_DEFAULT = OCI_COMMIT_ON_SUCCESS
- OCI_DESCRIBE_ONLY = 16
- PDO_MYSQL_BUFFERED_QUERY = true
- PWD_ENC_ALGORITHM = 'tiger192,4'
- REDIS_DATABASE = 0
- REDIS_HOST = '127.0.0.1'
- REDIS_PASSWORD = \null
- REDIS_PORT = 6379
- REDIS_SCHEME = 'tcp'
- DressAPI
- REDIS_USERNAME = \null
- RELATED_REPOSITORY_ID = 'id_repository'
- REPOSITORY_TABLE = 'repository'
- ROOT_FOLDER_ID = 1
- TOKEN_ENC_ALGORITHM = 'HS512'
Functions
- HandleList() : void
- Lists all available components with their metadata
- HandleRender() : void
- Renders a component for preview purposes
- ParseComponentParams() : array<string|int, mixed>
- Parses component parameters from HTML comment block.
- ParseComponentExamples() : array<string|int, mixed>
- Parses component examples from HTML comment block
- ParseComponentDescription() : string
- Parses component description from HTML comment block
- RenderSimplePreview() : string
- Renders a simple preview of a component
- SanitizeOutput() : string
- Sanitizes output to prevent XSS attacks
- ValidatePath() : string
- Validates and normalizes a path to prevent directory traversal attacks
- GetFullPath() : string
- Gets the full safe path by validating and resolving the relative path
- HandleUpload() : void
- Handles file upload requests
- HandleList() : void
- Lists files and folders in a directory
- HandleDelete() : void
- Deletes a file or folder recursively
- HandleRename() : void
- Renames a file or folder in the gallery
- HandleCreateFolder() : void
- Creates a new folder in the gallery
- MenuActiveClass() : string
- Returns CSS class string if the current URL matches the menu item URL.
- IsExternalUrl() : bool
- Checks if a URL points to an external site.
- ExternalTarget() : string
- Returns the target attribute for external links.
- MenuTitle() : string
- Returns the translated and formatted menu item title.
Constants
ALLOWED_EXTENSIONS
Allowed file extensions for uploads
public
array<string|int, mixed>
ALLOWED_EXTENSIONS
= ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg']
APP_NAME
public
mixed
APP_NAME
= 'core'
CACHE_DRIVER
public
mixed
CACHE_DRIVER
= 'file'
CACHE_ENABLED
public
mixed
CACHE_ENABLED
= \false
CACHE_ENCRYPTION_CIPHER
public
mixed
CACHE_ENCRYPTION_CIPHER
= 'aes-256-cbc'
CACHE_ENCRYPTION_ENABLED
public
mixed
CACHE_ENCRYPTION_ENABLED
= \true
CACHE_ENCRYPTION_KEY
public
mixed
CACHE_ENCRYPTION_KEY
= 'change-this-to-a-very-secret-and-long-key'
CACHE_MAX_SIZE_PER_ELEMENT
public
mixed
CACHE_MAX_SIZE_PER_ELEMENT
= 65536
CACHE_PATH
DressAPI
public
mixed
CACHE_PATH
= '/dev/shm/'
Tags
CORE_PATH
public
mixed
CORE_PATH
= \CORE_SRC_PATH . '/modules/base'
CORE_SRC_PATH
Base path to the core modules directory Path: core/src/api/components -> core/src/api -> core/src
public
string
CORE_SRC_PATH
= \dirname(__DIR__, 2)
DEFAULT_VIEW
Default view folder for components
public
string
DEFAULT_VIEW
= 'bi5'
DOMAIN_NAME
public
mixed
DOMAIN_NAME
= 'dressapi'
GALLERY_ROOT
Root directory for gallery files storage Shared location: /var/vhosts/dressapi/public-files
public
string
GALLERY_ROOT
= \dirname(__DIR__, 4) . '/public-files'
ITEM_ID
public
mixed
ITEM_ID
= 'id'
MAIL_DEBUG
public
mixed
MAIL_DEBUG
= false
MAIL_ENCRYPTION
public
mixed
MAIL_ENCRYPTION
= \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS
MAIL_PORT
public
mixed
MAIL_PORT
= 465
MAIL_SMTP_PROTOCOL
public
mixed
MAIL_SMTP_PROTOCOL
= true
MAX_LEVEL_FOLDERS
public
mixed
MAX_LEVEL_FOLDERS
= 20
MAX_UPLOAD_SIZE
Maximum file upload size in bytes (10MB)
public
int
MAX_UPLOAD_SIZE
= 10 * 1024 * 1024
OCI_DEFAULT
public
mixed
OCI_DEFAULT
= OCI_COMMIT_ON_SUCCESS
OCI_DESCRIBE_ONLY
public
mixed
OCI_DESCRIBE_ONLY
= 16
PDO_MYSQL_BUFFERED_QUERY
public
mixed
PDO_MYSQL_BUFFERED_QUERY
= true
PWD_ENC_ALGORITHM
public
mixed
PWD_ENC_ALGORITHM
= 'tiger192,4'
REDIS_DATABASE
public
mixed
REDIS_DATABASE
= 0
REDIS_HOST
public
mixed
REDIS_HOST
= '127.0.0.1'
REDIS_PASSWORD
public
mixed
REDIS_PASSWORD
= \null
REDIS_PORT
public
mixed
REDIS_PORT
= 6379
REDIS_SCHEME
DressAPI
public
mixed
REDIS_SCHEME
= 'tcp'
Tags
REDIS_USERNAME
public
mixed
REDIS_USERNAME
= \null
RELATED_REPOSITORY_ID
public
mixed
RELATED_REPOSITORY_ID
= 'id_repository'
REPOSITORY_TABLE
public
mixed
REPOSITORY_TABLE
= 'repository'
ROOT_FOLDER_ID
public
mixed
ROOT_FOLDER_ID
= 1
TOKEN_ENC_ALGORITHM
public
mixed
TOKEN_ENC_ALGORITHM
= 'HS512'
Functions
HandleList()
Lists all available components with their metadata
HandleList() : void
GET /api-core/components/?action=list&view=bi5
Tags
Return values
void —Outputs JSON response with components array
HandleRender()
Renders a component for preview purposes
HandleRender() : void
POST /api-core/components/?action=render Body: {"type": "card", "data": {"title": "Test"}}
Tags
Return values
void —Outputs JSON response with rendered HTML
ParseComponentParams()
Parses component parameters from HTML comment block.
ParseComponentParams(string $html) : array<string|int, mixed>
Expected format in template (PHPDoc-style):
Parameters
- $html : string
-
The template HTML content.
Tags
Return values
array<string|int, mixed> —['params' => array, 'is_repeater' => bool]
ParseComponentExamples()
Parses component examples from HTML comment block
ParseComponentExamples(string $html) : array<string|int, mixed>
Expected format:
EXAMPLE 1:
Parameters
- $html : string
-
The template HTML content
Return values
array<string|int, mixed> —Array of example objects with raw JSON data
ParseComponentDescription()
Parses component description from HTML comment block
ParseComponentDescription(string $html) : string
Extracts the component name from the first line of the comment
Parameters
- $html : string
-
The template HTML content
Return values
string —The component description or empty string
RenderSimplePreview()
Renders a simple preview of a component
RenderSimplePreview(string $template_file, array<string|int, mixed> $data) : string
This is a simplified renderer for editor preview. For full rendering, use CComponent class.
Parameters
- $template_file : string
-
Path to the template file
- $data : array<string|int, mixed>
-
Component data
Return values
string —Rendered HTML preview
SanitizeOutput()
Sanitizes output to prevent XSS attacks
SanitizeOutput(string|null $string) : string
Parameters
- $string : string|null
-
The string to sanitize
Return values
string —The sanitized string, empty if input is null
ValidatePath()
Validates and normalizes a path to prevent directory traversal attacks
ValidatePath(string $path) : string
Parameters
- $path : string
-
The path to validate
Return values
string —The sanitized path without dangerous characters
GetFullPath()
Gets the full safe path by validating and resolving the relative path
GetFullPath(string $relative_path) : string
Parameters
- $relative_path : string
-
The relative path to resolve
Tags
Return values
string —The full validated path
HandleUpload()
Handles file upload requests
HandleUpload() : void
Tags
Return values
void —Outputs JSON response
HandleList()
Lists files and folders in a directory
HandleList() : void
Tags
Return values
void —Outputs JSON response with list of items
HandleDelete()
Deletes a file or folder recursively
HandleDelete() : void
Tags
Return values
void —Outputs JSON response
HandleRename()
Renames a file or folder in the gallery
HandleRename() : void
Tags
Return values
void —Outputs JSON response with renamed item info
HandleCreateFolder()
Creates a new folder in the gallery
HandleCreateFolder() : void
Tags
Return values
void —Outputs JSON response with created folder info
MenuActiveClass()
Returns CSS class string if the current URL matches the menu item URL.
MenuActiveClass(string $current_url, string $item_url[, string $active_class = ' active' ]) : string
Parameters
- $current_url : string
-
The current page URL.
- $item_url : string
-
The menu item URL to compare.
- $active_class : string = ' active'
-
The CSS class to return when active.
Return values
string —The active class string or empty string.
IsExternalUrl()
Checks if a URL points to an external site.
IsExternalUrl(string $url) : bool
Parameters
- $url : string
-
The URL to check.
Return values
bool —True if the URL is external.
ExternalTarget()
Returns the target attribute for external links.
ExternalTarget(string|bool $url_or_is_external) : string
Accepts either a URL string or a pre-computed boolean from IsExternalUrl().
Parameters
- $url_or_is_external : string|bool
-
URL to check, or boolean result of IsExternalUrl().
Return values
string —' target="_blank"' for external URLs, empty string otherwise.
MenuTitle()
Returns the translated and formatted menu item title.
MenuTitle(array<string|int, mixed> $voice[, bool $ucfirst = true ]) : string
Parameters
- $voice : array<string|int, mixed>
-
The menu item array with 'title' and/or 'name' keys.
- $ucfirst : bool = true
-
Whether to capitalize the first letter.
Return values
string —The formatted title.