Ejemplo n.º 1
0
/**
 * Hash a string
 *
 * @param string $string Plain text string.
 *
 * @return bool|string Returns the hash, or FALSE on failure.
 */
function zHash($string)
{
    return password_hash($string, \ZigiPhp\App::getConfig('hash')['algo'], \ZigiPhp\App::getConfig('hash')['options']);
}
Ejemplo n.º 2
0
<?php

/**
 * RedBean service provider
 * @return \RedBeanPHP\ToolBox
 */
use ZigiPhp\App;
return function () {
    return \RedBeanPHP\R::setup(App::getConfig('redbean')['dsn'], App::getConfig('redbean')['username'], App::getConfig('redbean')['password'], App::getConfig('redbean')['frozen']);
};
Ejemplo n.º 3
0
<?php

/**
 * Blade service provider
 * @return \Philo\Blade\Blade
 */
use ZigiPhp\App;
return function () {
    $blade = new \Philo\Blade\Blade(App::getConfig('blade')['viewPath'], App::getConfig('blade')['cachePath']);
    $blade->getCompiler()->directive('trans', function ($expression) {
        return '<?php echo \\ZigiPhp\\Helpers\\I18n::__' . $expression . '; ?>';
    });
    $blade->getCompiler()->directive('form', function ($expression) {
        return '<?php ob_start(); ?>';
    });
    $blade->getCompiler()->directive('endform', function () {
        return '<?php \\ZigiPhp\\Helpers\\Form::create(ob_get_clean()); ?>';
    });
    return $blade;
};
Ejemplo n.º 4
0
<?php

/**
 * @return PHPMailer
 */
return function () {
    $mailer = new \PHPMailer();
    if (isset(\ZigiPhp\App::getConfig('mail')['type'])) {
        switch (\ZigiPhp\App::getConfig('mail')['type']) {
            case 'sendmail':
                $mailer->isSendmail();
                break;
            case 'qmail':
                $mailer->isQmail();
                break;
            case 'smtp':
                $mailer->isSMTP();
                if (isset(\ZigiPhp\App::getConfig('mail')['options'])) {
                    foreach (\ZigiPhp\App::getConfig('mail')['options'] as $option => $value) {
                        $mailer->{$option} = $value;
                    }
                }
                break;
        }
    }
    return $mailer;
};