Hints: It is recommended to use the methods in this class instead of PHP native methods whenever is possible because this class will offer Long Term Support and the methods will be supported even if the behind PHP methods can change over time, so the code would be easier to maintain.
Usage: static object: Class::method() - This class provides only STATIC methods
class Methods
public staticfunctionisAdminArea (
) {} :: BOOLEAN
@return: {BOOLEAN} if is ADMIN area will return TRUE else will return FALSE
Test if Admin (service) Area
For services running over admin.php / task.php will return TRUE ; for services running over index.php will return FALSE
public staticfunctionisTaskArea (
) {} :: BOOLEAN
@return: {BOOLEAN} if is TASK area will return TRUE else will return FALSE
Test if Task (service) Area (implies also to be isAdminArea() as well)
Task area is an Admin area with some unrestricted features ; it must be restricted by IP to avoid security issues ; it is designed to be used mostly in development but can be used in production by restricting the access to this area using the init setting: SMART_FRAMEWORK_RUNTIME_TASK_ALLOWED_IPS
For services running over task.php will return TRUE ; for services running over admin.php / index.php will return FALSE
public staticfunctionifDevMode (
) {} :: BOOL
@return: {BOOLEAN} if is Production Environment will return TRUE else will return FALSE (if FALSE it is always considered the Development Environment)
Test if Production Environment as set in init.php by SMART_FRAMEWORK_ENV
Production Environment (SMART_FRAMEWORK_ENV = 'prod') differ from Development Environment (SMART_FRAMEWORK_ENV = 'dev') especially by the fact that Production Environment avoids to display any error (will just log errors and warnings and will not log notices)
Using this method to detect if Production or Development Environment the code can have a dual behaviour Production vs Development
public staticfunctionifDebug (
) {} :: BOOL
@return: {BOOLEAN} if Debug is ON will return TRUE, else will return FALSE
Test if DEBUG is ON
Debug can be enabled on both: Production or Development Environments, by setting; define('SMART_FRAMEWORK_DEBUG_MODE', true); // init.php
Using Debug in Production Environment must be enabled per one IP only that can have access to that feature to avoid expose sensitive data to the world !!!
Ex: if(myIPIsDetected()) { define('SMART_FRAMEWORK_DEBUG_MODE', true); } // in init.php, for a Production Environment