public function view($view, $data = NULL) { // Try to load view from theme if (file_exists(config::get('application') . "/views/{$this->current}/{$view}.php")) { $this->dingo->load->view("{$this->current}/{$view}", $data); } elseif ($this->current != 'default' and file_exists(config::get('application') . "/views/default/{$view}.php")) { $this->dingo->load->view("default/{$view}", $data); } else { dingo_error(E_USER_WARNING, 'The requested theme view (' . config::get('application') . "/views/{$this->current}/{$view}.php) could not be found."); } }
public function __construct($driver, $host, $username, $password, $database) { $this->driver = $driver; $this->host = $host; $this->username = $username; $this->password = $password; $this->database = $database; try { $this->con = new pdo("{$this->driver}:dbname={$this->database};host={$this->host}", $this->username, $this->password); } catch (PDOException $e) { dingo_error(E_USER_ERROR, 'DB Connection Failed. ' . $e->getMessage()); } }
public static function add_connection($name) { $config = config::get('db'); // Check for configuration if (empty($config[$name])) { dingo_error(E_USER_ERROR, "DB Connection Settings For '{$name}' Not Found."); return FALSE; } $config = $config[$name]; // PDO Driver if (in_array($config['driver'], self::$pdo)) { load::driver('db', 'pdo'); $driver_class = 'pdo_db_connection'; } else { load::driver('db', $config['driver']); $driver_class = "{$config['driver']}_db_connection"; } // Connect self::$connections[$name] = new $driver_class($config['driver'], $config['host'], $config['username'], $config['password'], $config['database']); // Return connection return self::$connections[$name]; }
public function zone_crop($width, $height, $zone = 'center') { // Center if ($zone == 'center') { $x = ($width - $this->width) / -2; $y = ($height - $this->height) / -2; } elseif ($zone == 'top-left') { $x = 0; $y = 0; } elseif ($zone == 'top') { $x = ($this->width - $width) / 2; $y = 0; } elseif ($zone == 'top-right') { $x = $this->width - $width; $y = 0; } elseif ($zone == 'right') { $x = $this->width - $width; $y = ($this->height - $height) / 2; } elseif ($zone == 'bottom-right') { $x = $this->width - $width; $y = $this->height - $height; } elseif ($zone == 'bottom') { $x = ($this->width - $width) / 2; $y = $this->height - $height; } elseif ($zone == 'bottom-left') { $x = 0; $y = $this->height - $height; } elseif ($zone == 'left') { $x = 0; $y = ($this->height - $height) / 2; } else { dingo_error(E_USER_ERROR, "Invalid image crop zone '{$zone}' given for image helper zone_crop()."); } return $this->crop($x, $y, $width, $height); }
function dingo_exception($ex) { dingo_error('exception', $ex->getMessage(), $ex->getFile(), $ex->getLine()); //echo "<p>Uncaught exception in {$exception->getFile()} on line {$exception->getLine()}: <strong>{$exception->getMessage()}</strong></p>"; }
public static function view($view, $data = NULL) { // If view does not exist display error if (!file_exists(config::get('application') . '/' . config::get('folder_views') . "/{$view}.php")) { dingo_error(E_USER_WARNING, 'The requested view (' . config::get('application') . '/' . config::get('folder_views') . "/{$view}.php) could not be found."); return FALSE; } else { // If data is array, convert keys to variables if (is_array($data)) { extract($data, EXTR_OVERWRITE); } require config::get('application') . '/' . config::get('folder_views') . "/{$view}.php"; return FALSE; } }