Release 6.3.0: Core Functions

File Exists

etsis_file_exists($filename, $throw = true);

Checks if file exists, if not, throws exception if $throw is set to true (default).

Example

try {
    if(etsis_file_exists('/path/to/file/test.txt')) {
        include('/path/to/file/test.txt');
    }
} catch (app\src\Core\Exception\NotFoundException $e) {
    \Cascade\Cascade::getLogger('error')->error(sprintf('FILESTATE[%s]: File not found: %s', $e->getCode(), $e->getMessage()));
}

System Message Template

set_email_template($body);

Uses default template, but has a filter, so that you can set your own template.

Example

$app = \Liten\Liten::getInstance();

function set_my_message_template($body, $template)
{
    $template = _file_get_contents(APP_PATH . 'views/setting/tpl/my_email_alert.tpl');
    return str_replace('{content}', $body, $template);
}

$app->hook->{'add_filter'}('email_template', 'set_my_message_template', 2);