public static function init() { if (!self::$MvcDb instanceof MvcDb) { if (MvcApplication::get()) { self::$MvcDb = new MvcDb(MvcApplication::get()->configuration['db']); } else { throw new \Exception('Cannot Retrieve MvcApplication instance.'); } } return self::$MvcDb; }
public function composeBody($data) { $configuration = MvcApplication::get()->getConfiguration(); $this->body = '<html><body>'; $this->body .= '<table rules="all" style="border-color: #666;" cellpadding="10">'; $this->body .= "<tr style='background: #ff0000;'><td colspan='2'><strong>This email is for user verification. Please click the Account Activation Link below for activation of your account</strong> </td></tr>"; $this->body .= "<tr style='background: #eee;'><td><strong>Full Name:</strong> </td><td>" . strip_tags($data['firstname'] . ' ' . $data['middlename'] . ' ' . $data['firstname']) . "</td></tr>"; $this->body .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($data['email']) . "</td></tr>"; $this->body .= "<tr><td><strong>Password:</strong> </td><td>" . strip_tags($data['unhashed']) . "</td></tr>"; $this->body .= "<tr><td><strong>Phone Number:</strong> </td><td>" . strip_tags($data['phonenumber']) . "</td></tr>"; $this->body .= "<tr><td><strong>Link for Account Activation:</strong> </td><td>" . strip_tags($configuration['app']['path'] . '/registration/activation/') . base64_encode($data['email']) . "</td></tr>"; $this->body .= "</table>"; $this->body .= "</body></html>"; return $this; }
public function getBaseUrl() { return MvcApplication::get() ? MvcApplication::get()->configuration['app']['path'] : ''; }
<?php /** * Created by Arem G. Aguinaldo * Date: 11/16/15 */ define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(dirname(__FILE__))); $included_path = array(ROOT, ROOT . DS . 'config', ROOT . DS . 'library', ROOT . DS . 'module', get_include_path()); set_include_path(implode(';', $included_path)); /** Autoload any classes that are required **/ function fileLocator($className) { if (file_exists(ROOT . DS . 'library' . DS . str_replace('\\', '/', ucwords($className)) . '.php') || file_exists(ROOT . DS . 'module' . DS . str_replace('\\', '/', ucwords($className)) . '.php')) { require_once str_replace('\\', '/', ucwords($className)) . '.php'; } else { throw new Exception('Application File Not Found [' . __FILE__ . ' line ' . __LINE__ . ']'); } } spl_autoload_register('fileLocator'); \Application\MvcApplication::init(include_once 'config.php')->run();