From 2df9ae501012ddbc77f77924554a2fe69a39e12b Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 12 May 2020 20:48:23 +0200 Subject: [PATCH] Removed "engine/core" files (will not be used eventually). --- engine/Core/Controller.php | 23 ----- engine/Core/Framework.php | 43 --------- engine/Core/Input.php | 145 ------------------------------ engine/Core/Migration.php | 23 ----- engine/Core/Model.php | 23 ----- engine/Core/Output.php | 82 ----------------- engine/Core/QueryBuilder.php | 166 ----------------------------------- engine/Core/Session.php | 77 ---------------- 8 files changed, 582 deletions(-) delete mode 100644 engine/Core/Controller.php delete mode 100644 engine/Core/Framework.php delete mode 100644 engine/Core/Input.php delete mode 100644 engine/Core/Migration.php delete mode 100644 engine/Core/Model.php delete mode 100644 engine/Core/Output.php delete mode 100644 engine/Core/QueryBuilder.php delete mode 100644 engine/Core/Session.php diff --git a/engine/Core/Controller.php b/engine/Core/Controller.php deleted file mode 100644 index 1841cd85..00000000 --- a/engine/Core/Controller.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Controller - * - * @package EA\Engine\Core - */ -class Controller extends \CI_Controller { - -} diff --git a/engine/Core/Framework.php b/engine/Core/Framework.php deleted file mode 100644 index da0e15d9..00000000 --- a/engine/Core/Framework.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Framework - * - * @package EA\Engine\Core - */ -class Framework { - /** - * Get the framework instance. - * - * @return \CI_Controller - */ - public static function getInstance() - { - return get_instance(); - } - - /** - * Magit get method that gives access to the internal members of the framework intance. - * - * @param string $key - * - * @return mixed - */ - public function __get($key) - { - return self::getInstance()->$key; - } -} diff --git a/engine/Core/Input.php b/engine/Core/Input.php deleted file mode 100644 index a033e0d1..00000000 --- a/engine/Core/Input.php +++ /dev/null @@ -1,145 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Input - * - * @package EA\Engine\Core - */ -class Input { - /** - * @var \EA\Engine\Core\Framework - */ - private $framework; - - /** - * Input constructor. - * - * @param Framework $framework - */ - public function __construct(Framework $framework) - { - $this->framework = $framework; - } - - - /** - * Get request (either GET or POST) parameter (not filtered/escaped). - * - * @param string $key - * - * @return string - */ - public function request($key) - { - return isset($_REQUEST[$key]) ? $_REQUEST[$key] : NULL; - } - - /** - * Get GET parameter value. - * - * @param string $key - */ - public function get($key) - { - $this->framework->input->get($key); - } - - /** - * Get POST parameter value. - * - * @param string $key - */ - public function post($key) - { - $this->framework->input->post($key); - } - - /** - * Get COOKIE parameter value. - * - * @param string $key - * - * @return string - */ - public function cookie($key) - { - return $this->framework->input->cookie($key); - } - - /** - * Get SERVER parameter value. - * - * @param string $key - * - * @return string - */ - public function server($key) - { - return $this->framework->input->server($key); - } - - /** - * Get raw request input. - * - * @return string - */ - public function raw() - { - return $this->framework->input->raw_input_stream; - } - - /** - * Get json decoded raw request input. - * - * @return string - */ - public function json() - { - return json_decode($this->framework->input->raw_input_stream); - } - - /** - * Get request headers as an array. - * - * @return array - */ - public function headers() - { - return $this->framework->input->request_headers(); - } - - /** - * Get request header value. - * - * @param string $key - * - * @return string - */ - public function header($key) - { - return $this->framework->input->get_request_header($key); - } - - /** - * Determine if this is a CLI request or not. - * - * @return bool - */ - public function isCliRequest() - { - return $this->framework->is_cli_request(); - } -} diff --git a/engine/Core/Migration.php b/engine/Core/Migration.php deleted file mode 100644 index 278028f6..00000000 --- a/engine/Core/Migration.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Migration - * - * @package EA\Engine\Core - */ -class Migration extends \CI_Migration { - -} diff --git a/engine/Core/Model.php b/engine/Core/Model.php deleted file mode 100644 index 5a0f027a..00000000 --- a/engine/Core/Model.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Model - * - * @package EA\Engine\Core - */ -class Model extends \CI_Model { - -} diff --git a/engine/Core/Output.php b/engine/Core/Output.php deleted file mode 100644 index 1f37f1c5..00000000 --- a/engine/Core/Output.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Output - * - * @package EA\Engine\Core - */ -class Output { - /** - * @var \EA\Engine\Core\Framework - */ - private $framework; - - /** - * Output constructor. - * - * @param Framework $framework - */ - public function __construct(Framework $framework) - { - $this->framework = $framework; - } - - /** - * Output HTML markup content. - * - * @param string $content - * @param int $statusCode - * @param array $headers - */ - public function html($content, $statusCode = 200, array $headers = []) - { - $headers[] = 'Content-Type: text/html'; - $this->write($content, $statusCode, $headers); - } - - /** - * Output JSON encoded content. - * - * @param mixed $content - * @param int $statusCode - * @param array $headers - */ - public function json($content, $statusCode = 200, array $headers = []) - { - $headers[] = 'Content-Type: application/json; charset=utf-8'; - $content = json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - $this->write($content, $statusCode, $headers); - } - - /** - * Output arbitrary content with custom status and headers. - * - * @param string $content - * @param int $statusCode - * @param array $headers - */ - public function write($content, $statusCode = 200, array $headers = []) - { - $this->framework->output->set_status_header($statusCode); - - foreach ($headers as $header) - { - $this->framework->output->set_header($header); - } - - $this->framework->output->set_output($content); - } -} diff --git a/engine/Core/QueryBuilder.php b/engine/Core/QueryBuilder.php deleted file mode 100644 index e41cb822..00000000 --- a/engine/Core/QueryBuilder.php +++ /dev/null @@ -1,166 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class QueryBuilder - * - * @package EA\Engine\Core - */ -class QueryBuilder { - /** - * @var \EA\Engine\Core\Framework - */ - private $framework; - - /** - * QueryBuilder constructor. - * - * @param \EA\Engine\Core\Framework $framework - */ - public function __construct(Framework $framework) - { - $this->framework = $framework; - } - - - /** - * Count matching query rows. - * - * @param string $table - * @param mixed $conditions - * - * @return int - */ - public function count($table, $conditions) - { - return $this->framework->db->get_where($table, $conditions)->num_rows(); - } - - /** - * Perform an arbitrary query to the databbase. - * - * @param $query - * - * @return mixed - */ - public function query($query) - { - return $this->framework->db->query($query); - } - - /** - * Get a single database row, based on the provided conditions. - * - * @param string $table - * @param mixed $conditions - * - * @return mixed - */ - public function row($table, $conditions) - { - return $this->framework->db->get_where($table, $conditions)->row_array(); - } - - /** - * Get a collection of rows, based on the provided parameters. - * - * @param string $table - * @param mixed|null $conditions - * @param int|null $limit - * @param int|null $offset - * @param mixed|null $order - * - * @return mixed - */ - public function collection($table, $conditions = NULL, $limit = NULL, $offset = NULL, $order = NULL) - { - if ($limit) - { - $this->framework->db->limit($limit); - } - - if ($limit && $offset) - { - $this->framework->db->limit($limit, $offset); - } - - if ($order) - { - $this->framework->db->order_by($order); - } - - if ($conditions) - { - $this->framework->db->where($conditions); - } - - return $this->framework->db->get($table)->result_array(); - } - - /** - * Insert a new database row. - * - * @param string $table - * @param array $row - * - * @return int Returns the inserted ID. - */ - public function insert($table, $row) - { - $this->framework->db->insert($table, $row); - - return $this->framework->db->insert_id(); - } - - /** - * Update an existing database row. - * - * @param string $table - * @param array $row - * @param mixed $conditions - * - * @return mixed Returns the operation result. - */ - public function update($table, $row, $conditions) - { - return $this->framework->db->update($table, $row, $conditions); - } - - /** - * Delete an existing database row. - * - * @param string $table - * @param array $row - * @param mixed $conditions - * - * @return mixed - */ - public function delete($table, $row, $conditions) - { - return $this->framework->db->delete($table, $row, $conditions); - } - - /** - * Escape a raw value before using it in a query. - * - * @param string $value - * - * @return string - */ - public function escape($value) - { - return $this->framework->db->escape($value); - } -} diff --git a/engine/Core/Session.php b/engine/Core/Session.php deleted file mode 100644 index 35b562f2..00000000 --- a/engine/Core/Session.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.4.0 - * ---------------------------------------------------------------------------- */ - -namespace EA\Engine\Core; - -/** - * Class Session - * - * @package EA\Engine\Core - */ -class Session { - /** - * @var \EA\Engine\Core\Framework - */ - private $framework; - - /** - * Session constructor. - * - * @param Framework $framework - */ - public function __construct(Framework $framework) - { - $this->framework = $framework; - } - - - /** - * Create a new session for the current user. - */ - public function create() - { - $this->framework->load->library('session'); - } - - /** - * Destroy the session of the current user. - */ - public function destroy() - { - $this->framework->session->sess_destroy(); - } - - /** - * Get a session value. - * - * @param string $key - * - * @return mixed - */ - public function get($key) - { - return $this->framework->session->userdata($key); - } - - /** - * Set a session value. - * - * @param string $key - * - * @param mixed $value - */ - public function set($key, $value) - { - $this->framework->session->userdata($key, $value); - } -}