From 02c0a117a9b871eba34792ccb745e8a7c5b7d30e Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Mon, 26 Dec 2022 10:57:37 +0700 Subject: [PATCH] Upgrade --- hungng/HungNG_CI_Base_Controllers.php | 130 ++++++++++++------------- hungng/HungNG_CI_Base_Module.php | 130 ++++++++++++------------- hungng/HungNG_CI_Base_Queue_Worker.php | 116 +++++++++++----------- hungng/HungNG_Custom_Based_model.php | 114 +++++++++++----------- hungng/HungNG_ORM_Model.php | 26 ++--- 5 files changed, 258 insertions(+), 258 deletions(-) diff --git a/hungng/HungNG_CI_Base_Controllers.php b/hungng/HungNG_CI_Base_Controllers.php index 8704970..8033a16 100644 --- a/hungng/HungNG_CI_Base_Controllers.php +++ b/hungng/HungNG_CI_Base_Controllers.php @@ -14,50 +14,50 @@ * @author 713uk13m * @copyright 713uk13m * - * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. - * @property CI_Calendar $calendar This class enables the creation of calendars - * @property CI_Cache $cache Caching Class - * @property CI_Cart $cart Shopping Cart Class - * @property CI_Config $config This class contains functions that enable config files to be managed - * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to - * @property CI_DB_forge $dbforge Database Forge Class - * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder $db This is the platform-independent base Query Builder implementation class - * @property CI_DB_utility $dbutil Database Utility Class - * @property CI_Driver_Library $driver Driver Library Class - * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP - * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt - * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions - * @property CI_Exceptions $exceptions Exceptions Class - * @property CI_Form_validation $form_validation Form Validation Class - * @property CI_FTP $ftp FTP Class - * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking - * @property CI_Image_lib $image_lib Image Manipulation class - * @property CI_Input $input Pre-processes global input data for security - * @property CI_Javascript $javascript Javascript Class - * @property CI_Jquery $jquery Jquery Class - * @property CI_Lang $lang Language Class - * @property CI_Loader $load Loads framework components - * @property CI_Log $log Logging Class - * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global - * @property CI_Model $model CodeIgniter Model Class - * @property CI_Output $output Responsible for sending final output to the browser - * @property CI_Pagination $pagination Pagination Class - * @property CI_Parser $parser Parser Class - * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. - * @property CI_Router $router Parses URIs and determines routing - * @property CI_Security $security Security Class - * @property CI_Session $session Session Class - * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays - * @property CI_Trackback $trackback Trackback Sending/Receiving Class - * @property CI_Typography $typography Typography Class - * @property CI_Unit_test $unit Simple testing class - * @property CI_Upload $upload File Uploading Class - * @property CI_URI $uri Parses URIs and determines routing - * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent - * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class - * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class - * @property CI_Zip $zip Zip Compression Class - * @property CI_Utf8 $utf8 Provides support for UTF-8 environments + * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. + * @property CI_Calendar $calendar This class enables the creation of calendars + * @property CI_Cache $cache Caching Class + * @property CI_Cart $cart Shopping Cart Class + * @property CI_Config $config This class contains functions that enable config files to be managed + * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to + * @property CI_DB_forge $dbforge Database Forge Class + * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder|CI_DB_driver $db This is the platform-independent base Query Builder implementation class + * @property CI_DB_utility $dbutil Database Utility Class + * @property CI_Driver_Library $driver Driver Library Class + * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP + * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt + * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions + * @property CI_Exceptions $exceptions Exceptions Class + * @property CI_Form_validation $form_validation Form Validation Class + * @property CI_FTP $ftp FTP Class + * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking + * @property CI_Image_lib $image_lib Image Manipulation class + * @property CI_Input $input Pre-processes global input data for security + * @property CI_Javascript $javascript Javascript Class + * @property CI_Jquery $jquery Jquery Class + * @property CI_Lang $lang Language Class + * @property CI_Loader $load Loads framework components + * @property CI_Log $log Logging Class + * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global + * @property CI_Model $model CodeIgniter Model Class + * @property CI_Output $output Responsible for sending final output to the browser + * @property CI_Pagination $pagination Pagination Class + * @property CI_Parser $parser Parser Class + * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. + * @property CI_Router $router Parses URIs and determines routing + * @property CI_Security $security Security Class + * @property CI_Session $session Session Class + * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays + * @property CI_Trackback $trackback Trackback Sending/Receiving Class + * @property CI_Typography $typography Typography Class + * @property CI_Unit_test $unit Simple testing class + * @property CI_Upload $upload File Uploading Class + * @property CI_URI $uri Parses URIs and determines routing + * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent + * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class + * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class + * @property CI_Zip $zip Zip Compression Class + * @property CI_Utf8 $utf8 Provides support for UTF-8 environments */ class HungNG_CI_Base_Controllers extends CI_Controller { @@ -113,10 +113,10 @@ protected function defaultJsonResponseInfo() */ protected function renderOutput($response) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; if (method_exists($this, 'log')) { $this->log('RequestAPI', $message, $response); } @@ -135,10 +135,10 @@ protected function renderOutput($response) */ protected function renderOutputPretty($response) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; if (method_exists($this, 'log')) { $this->log('RequestAPI', $message, $response); } @@ -157,10 +157,10 @@ protected function renderOutputPretty($response) */ protected function jsonResponse($response = array(), $status = 200) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; log_message('debug', $message); if (is_array($response) || is_object($response)) { $response = json_encode($response); @@ -180,10 +180,10 @@ protected function jsonResponse($response = array(), $status = 200) */ protected function jsonResponsePretty($response = array(), $status = 200) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; log_message('debug', $message); if (is_array($response) || is_object($response)) { $response = json_encode($response, JSON_PRETTY_PRINT); @@ -208,8 +208,8 @@ protected function errorExceptionResponse($exception) log_message('error', $errorMessage); log_message('error', $exception->getTraceAsString()); - $response = array(); - $response['code'] = StatusCodes::HTTP_BAD_REQUEST; + $response = array(); + $response['code'] = StatusCodes::HTTP_BAD_REQUEST; $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; if ( ( @@ -243,9 +243,9 @@ protected function errorExceptionResponse($exception) */ protected function errorResponse($message = '') { - $response = array(); - $response['code'] = StatusCodes::HTTP_BAD_REQUEST; - $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; + $response = array(); + $response['code'] = StatusCodes::HTTP_BAD_REQUEST; + $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; $response['errorMessage'] = $message; return $response; @@ -298,8 +298,8 @@ protected function errorCredentialsResponse($message = '') */ protected function errorSignatureResponse($validSignature = array()) { - $response = array(); - $response['code'] = StatusCodes::HTTP_FORBIDDEN; + $response = array(); + $response['code'] = StatusCodes::HTTP_FORBIDDEN; $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_FORBIDDEN]; if ((defined('_PROCESS_TEST_') && _PROCESS_TEST_ === true) || in_array(getIPAddress(), config_item('whitelist_ip'), true)) { $response['validSignature'] = $validSignature; @@ -350,9 +350,9 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve default: $keyLevel = Monolog\Logger::INFO; } - $fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; + $fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; $formatter = new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s u"); - $stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); + $stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); $stream->setFormatter($formatter); $logger = new Monolog\Logger(trim($name)); $logger->pushHandler($stream); diff --git a/hungng/HungNG_CI_Base_Module.php b/hungng/HungNG_CI_Base_Module.php index b83e3bd..794a24c 100644 --- a/hungng/HungNG_CI_Base_Module.php +++ b/hungng/HungNG_CI_Base_Module.php @@ -14,50 +14,50 @@ * @author 713uk13m * @copyright 713uk13m * - * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. - * @property CI_Calendar $calendar This class enables the creation of calendars - * @property CI_Cache $cache Caching Class - * @property CI_Cart $cart Shopping Cart Class - * @property CI_Config $config This class contains functions that enable config files to be managed - * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to - * @property CI_DB_forge $dbforge Database Forge Class - * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder $db This is the platform-independent base Query Builder implementation class - * @property CI_DB_utility $dbutil Database Utility Class - * @property CI_Driver_Library $driver Driver Library Class - * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP - * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt - * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions - * @property CI_Exceptions $exceptions Exceptions Class - * @property CI_Form_validation $form_validation Form Validation Class - * @property CI_FTP $ftp FTP Class - * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking - * @property CI_Image_lib $image_lib Image Manipulation class - * @property CI_Input $input Pre-processes global input data for security - * @property CI_Javascript $javascript Javascript Class - * @property CI_Jquery $jquery Jquery Class - * @property CI_Lang $lang Language Class - * @property CI_Loader $load Loads framework components - * @property CI_Log $log Logging Class - * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global - * @property CI_Model $model CodeIgniter Model Class - * @property CI_Output $output Responsible for sending final output to the browser - * @property CI_Pagination $pagination Pagination Class - * @property CI_Parser $parser Parser Class - * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. - * @property CI_Router $router Parses URIs and determines routing - * @property CI_Security $security Security Class - * @property CI_Session $session Session Class - * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays - * @property CI_Trackback $trackback Trackback Sending/Receiving Class - * @property CI_Typography $typography Typography Class - * @property CI_Unit_test $unit Simple testing class - * @property CI_Upload $upload File Uploading Class - * @property CI_URI $uri Parses URIs and determines routing - * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent - * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class - * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class - * @property CI_Zip $zip Zip Compression Class - * @property CI_Utf8 $utf8 Provides support for UTF-8 environments + * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. + * @property CI_Calendar $calendar This class enables the creation of calendars + * @property CI_Cache $cache Caching Class + * @property CI_Cart $cart Shopping Cart Class + * @property CI_Config $config This class contains functions that enable config files to be managed + * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to + * @property CI_DB_forge $dbforge Database Forge Class + * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder|CI_DB_driver $db This is the platform-independent base Query Builder implementation class + * @property CI_DB_utility $dbutil Database Utility Class + * @property CI_Driver_Library $driver Driver Library Class + * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP + * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt + * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions + * @property CI_Exceptions $exceptions Exceptions Class + * @property CI_Form_validation $form_validation Form Validation Class + * @property CI_FTP $ftp FTP Class + * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking + * @property CI_Image_lib $image_lib Image Manipulation class + * @property CI_Input $input Pre-processes global input data for security + * @property CI_Javascript $javascript Javascript Class + * @property CI_Jquery $jquery Jquery Class + * @property CI_Lang $lang Language Class + * @property CI_Loader $load Loads framework components + * @property CI_Log $log Logging Class + * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global + * @property CI_Model $model CodeIgniter Model Class + * @property CI_Output $output Responsible for sending final output to the browser + * @property CI_Pagination $pagination Pagination Class + * @property CI_Parser $parser Parser Class + * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. + * @property CI_Router $router Parses URIs and determines routing + * @property CI_Security $security Security Class + * @property CI_Session $session Session Class + * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays + * @property CI_Trackback $trackback Trackback Sending/Receiving Class + * @property CI_Typography $typography Typography Class + * @property CI_Unit_test $unit Simple testing class + * @property CI_Upload $upload File Uploading Class + * @property CI_URI $uri Parses URIs and determines routing + * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent + * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class + * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class + * @property CI_Zip $zip Zip Compression Class + * @property CI_Utf8 $utf8 Provides support for UTF-8 environments */ class HungNG_CI_Base_Module extends MX_Controller { @@ -113,10 +113,10 @@ protected function defaultJsonResponseInfo() */ protected function renderOutput($response) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; if (method_exists($this, 'log')) { $this->log('RequestAPI', $message, $response); } @@ -135,10 +135,10 @@ protected function renderOutput($response) */ protected function renderOutputPretty($response) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; if (method_exists($this, 'log')) { $this->log('RequestAPI', $message, $response); } @@ -157,10 +157,10 @@ protected function renderOutputPretty($response) */ protected function jsonResponse($response = array(), $status = 200) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; log_message('debug', $message); if (is_array($response) || is_object($response)) { $response = json_encode($response); @@ -180,10 +180,10 @@ protected function jsonResponse($response = array(), $status = 200) */ protected function jsonResponsePretty($response = array(), $status = 200) { - $method = $this->input->method(true); - $ip = getIPAddress(); + $method = $this->input->method(true); + $ip = getIPAddress(); $userAgent = $this->input->user_agent(true); - $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; + $message = 'Received ' . $method . ' Request from IP: ' . $ip . ' - With User Agent: ' . $userAgent; log_message('debug', $message); if (is_array($response) || is_object($response)) { $response = json_encode($response, JSON_PRETTY_PRINT); @@ -208,8 +208,8 @@ protected function errorExceptionResponse($exception) log_message('error', $errorMessage); log_message('error', $exception->getTraceAsString()); - $response = array(); - $response['code'] = StatusCodes::HTTP_BAD_REQUEST; + $response = array(); + $response['code'] = StatusCodes::HTTP_BAD_REQUEST; $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; if ( ( @@ -243,9 +243,9 @@ protected function errorExceptionResponse($exception) */ protected function errorResponse($message = '') { - $response = array(); - $response['code'] = StatusCodes::HTTP_BAD_REQUEST; - $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; + $response = array(); + $response['code'] = StatusCodes::HTTP_BAD_REQUEST; + $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_BAD_REQUEST]; $response['errorMessage'] = $message; return $response; @@ -298,8 +298,8 @@ protected function errorCredentialsResponse($message = '') */ protected function errorSignatureResponse($validSignature = array()) { - $response = array(); - $response['code'] = StatusCodes::HTTP_FORBIDDEN; + $response = array(); + $response['code'] = StatusCodes::HTTP_FORBIDDEN; $response['message'] = StatusCodes::$statusTexts[StatusCodes::HTTP_FORBIDDEN]; if ((defined('_PROCESS_TEST_') && _PROCESS_TEST_ === true) || in_array(getIPAddress(), config_item('whitelist_ip'), true)) { $response['validSignature'] = $validSignature; @@ -350,9 +350,9 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve default: $keyLevel = Monolog\Logger::INFO; } - $fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; + $fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log'; $formatter = new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s u"); - $stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); + $stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777); $stream->setFormatter($formatter); $logger = new Monolog\Logger(trim($name)); $logger->pushHandler($stream); diff --git a/hungng/HungNG_CI_Base_Queue_Worker.php b/hungng/HungNG_CI_Base_Queue_Worker.php index ce2e012..8f81b25 100644 --- a/hungng/HungNG_CI_Base_Queue_Worker.php +++ b/hungng/HungNG_CI_Base_Queue_Worker.php @@ -14,50 +14,50 @@ * @author 713uk13m * @copyright 713uk13m * - * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. - * @property CI_Calendar $calendar This class enables the creation of calendars - * @property CI_Cache $cache Caching Class - * @property CI_Cart $cart Shopping Cart Class - * @property CI_Config $config This class contains functions that enable config files to be managed - * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to - * @property CI_DB_forge $dbforge Database Forge Class - * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder $db This is the platform-independent base Query Builder implementation class - * @property CI_DB_utility $dbutil Database Utility Class - * @property CI_Driver_Library $driver Driver Library Class - * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP - * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt - * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions - * @property CI_Exceptions $exceptions Exceptions Class - * @property CI_Form_validation $form_validation Form Validation Class - * @property CI_FTP $ftp FTP Class - * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking - * @property CI_Image_lib $image_lib Image Manipulation class - * @property CI_Input $input Pre-processes global input data for security - * @property CI_Javascript $javascript Javascript Class - * @property CI_Jquery $jquery Jquery Class - * @property CI_Lang $lang Language Class - * @property CI_Loader $load Loads framework components - * @property CI_Log $log Logging Class - * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global - * @property CI_Model $model CodeIgniter Model Class - * @property CI_Output $output Responsible for sending final output to the browser - * @property CI_Pagination $pagination Pagination Class - * @property CI_Parser $parser Parser Class - * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. - * @property CI_Router $router Parses URIs and determines routing - * @property CI_Security $security Security Class - * @property CI_Session $session Session Class - * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays - * @property CI_Trackback $trackback Trackback Sending/Receiving Class - * @property CI_Typography $typography Typography Class - * @property CI_Unit_test $unit Simple testing class - * @property CI_Upload $upload File Uploading Class - * @property CI_URI $uri Parses URIs and determines routing - * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent - * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class - * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class - * @property CI_Zip $zip Zip Compression Class - * @property CI_Utf8 $utf8 Provides support for UTF-8 environments + * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. + * @property CI_Calendar $calendar This class enables the creation of calendars + * @property CI_Cache $cache Caching Class + * @property CI_Cart $cart Shopping Cart Class + * @property CI_Config $config This class contains functions that enable config files to be managed + * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to + * @property CI_DB_forge $dbforge Database Forge Class + * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder|CI_DB_driver $db This is the platform-independent base Query Builder implementation class + * @property CI_DB_utility $dbutil Database Utility Class + * @property CI_Driver_Library $driver Driver Library Class + * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP + * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt + * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions + * @property CI_Exceptions $exceptions Exceptions Class + * @property CI_Form_validation $form_validation Form Validation Class + * @property CI_FTP $ftp FTP Class + * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking + * @property CI_Image_lib $image_lib Image Manipulation class + * @property CI_Input $input Pre-processes global input data for security + * @property CI_Javascript $javascript Javascript Class + * @property CI_Jquery $jquery Jquery Class + * @property CI_Lang $lang Language Class + * @property CI_Loader $load Loads framework components + * @property CI_Log $log Logging Class + * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global + * @property CI_Model $model CodeIgniter Model Class + * @property CI_Output $output Responsible for sending final output to the browser + * @property CI_Pagination $pagination Pagination Class + * @property CI_Parser $parser Parser Class + * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. + * @property CI_Router $router Parses URIs and determines routing + * @property CI_Security $security Security Class + * @property CI_Session $session Session Class + * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays + * @property CI_Trackback $trackback Trackback Sending/Receiving Class + * @property CI_Typography $typography Typography Class + * @property CI_Unit_test $unit Simple testing class + * @property CI_Upload $upload File Uploading Class + * @property CI_URI $uri Parses URIs and determines routing + * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent + * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class + * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class + * @property CI_Zip $zip Zip Compression Class + * @property CI_Utf8 $utf8 Provides support for UTF-8 environments */ class HungNG_CI_Base_Queue_Worker extends HungNG_CI_Base_Controllers { @@ -232,17 +232,17 @@ public function listen() // Worker command builder // Be careful to avoid infinite loop by opening listener itself $workerAction = 'work'; - $route = $this->router->fetch_directory() . $this->router->fetch_class() . "/{$workerAction}"; - $workerCmd = "{$this->phpCommand} " . FCPATH . "index.php {$route}"; + $route = $this->router->fetch_directory() . $this->router->fetch_class() . "/{$workerAction}"; + $workerCmd = "{$this->phpCommand} " . FCPATH . "index.php {$route}"; // Static variables - $startTime = 0; + $startTime = 0; $workerCount = 0; $workingFlag = false; // Setting check - $this->workerMaxNum = ($this->workerMaxNum >= 1) ? floor($this->workerMaxNum) : 1; - $this->workerStartNum = ($this->workerStartNum <= $this->workerMaxNum) ? floor($this->workerStartNum) : $this->workerMaxNum; + $this->workerMaxNum = ($this->workerMaxNum >= 1) ? floor($this->workerMaxNum) : 1; + $this->workerStartNum = ($this->workerStartNum <= $this->workerMaxNum) ? floor($this->workerStartNum) : $this->workerMaxNum; $this->workerWaitSeconds = ($this->workerWaitSeconds >= 1) ? $this->workerWaitSeconds : 10; while (true) { @@ -263,7 +263,7 @@ public function listen() // First time to assign works if (!$workingFlag) { $workingFlag = true; - $startTime = microtime(true); + $startTime = microtime(true); $this->_log("Queue Listener - Job detect"); $this->_log("Queue Listener - Start dispatch"); @@ -309,7 +309,7 @@ public function listen() $workerCount = 0; // Clear worker stack $this->_pidStack = []; - $costSeconds = number_format(microtime(true) - $startTime, 2, '.', ''); + $costSeconds = number_format(microtime(true) - $startTime, 2, '.', ''); $this->_log("Queue Listener - Job empty"); $this->_log("Queue Listener - Stop dispatch, total cost: {$costSeconds}s"); } @@ -344,7 +344,7 @@ public function work($id = 1) // Start worker $startTime = microtime(true); - $pid = getmypid(); + $pid = getmypid(); // Print worker close $this->_print("Queue Worker - Create #{$id} (PID: {$pid})"); @@ -394,13 +394,13 @@ public function launch($action = 'listen') // Action command builder $route = $this->router->fetch_directory() . $this->router->fetch_class() . "/{$action}"; - $cmd = "{$this->phpCommand} " . FCPATH . "index.php {$route}"; + $cmd = "{$this->phpCommand} " . FCPATH . "index.php {$route}"; // Check process exists $search = str_replace('/', '\/', $route); // $result = shell_exec("pgrep -f \"{$search}\""); // Lacks of display info // Find out the process by name - $psCmd = "ps aux | grep \"{$search}\" | grep -v grep"; + $psCmd = "ps aux | grep \"{$search}\" | grep -v grep"; $psInfoCmd = "ps aux | egrep \"PID|{$search}\" | grep -v grep"; if ((shell_exec($psCmd))) { $exist = true; @@ -416,9 +416,9 @@ public function launch($action = 'listen') // Launch by calling command $launchCmd = "{$cmd} > {$logPath} &"; - $result = shell_exec($launchCmd); - $result = shell_exec($psCmd); - $psInfo = shell_exec($psInfoCmd); + $result = shell_exec($launchCmd); + $result = shell_exec($psCmd); + $psInfo = shell_exec($psInfoCmd); echo "Success to launch process `{$action}`: {$route}.\nCalled command: {$launchCmd}\n------\n{$psInfo}"; return; @@ -568,7 +568,7 @@ protected function _workerCmd($workerCmd, $workerCount) $process = proc_open("{$cmd} &", self::$_procDescriptorspec, $pipe); // Find out worker command's PID $status = proc_get_status($process); - $pid = $status['pid'] + 1; + $pid = $status['pid'] + 1; // Stack workers $this->_pidStack[$workerCount] = $pid; // Close diff --git a/hungng/HungNG_Custom_Based_model.php b/hungng/HungNG_Custom_Based_model.php index 648ee8e..578e929 100644 --- a/hungng/HungNG_Custom_Based_model.php +++ b/hungng/HungNG_Custom_Based_model.php @@ -14,50 +14,50 @@ * @author 713uk13m * @copyright 713uk13m * - * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. - * @property CI_Calendar $calendar This class enables the creation of calendars - * @property CI_Cache $cache Caching Class - * @property CI_Cart $cart Shopping Cart Class - * @property CI_Config $config This class contains functions that enable config files to be managed - * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to - * @property CI_DB_forge $dbforge Database Forge Class - * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder $db This is the platform-independent base Query Builder implementation class - * @property CI_DB_utility $dbutil Database Utility Class - * @property CI_Driver_Library $driver Driver Library Class - * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP - * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt - * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions - * @property CI_Exceptions $exceptions Exceptions Class - * @property CI_Form_validation $form_validation Form Validation Class - * @property CI_FTP $ftp FTP Class - * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking - * @property CI_Image_lib $image_lib Image Manipulation class - * @property CI_Input $input Pre-processes global input data for security - * @property CI_Javascript $javascript Javascript Class - * @property CI_Jquery $jquery Jquery Class - * @property CI_Lang $lang Language Class - * @property CI_Loader $load Loads framework components - * @property CI_Log $log Logging Class - * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global - * @property CI_Model $model CodeIgniter Model Class - * @property CI_Output $output Responsible for sending final output to the browser - * @property CI_Pagination $pagination Pagination Class - * @property CI_Parser $parser Parser Class - * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. - * @property CI_Router $router Parses URIs and determines routing - * @property CI_Security $security Security Class - * @property CI_Session $session Session Class - * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays - * @property CI_Trackback $trackback Trackback Sending/Receiving Class - * @property CI_Typography $typography Typography Class - * @property CI_Unit_test $unit Simple testing class - * @property CI_Upload $upload File Uploading Class - * @property CI_URI $uri Parses URIs and determines routing - * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent - * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class - * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class - * @property CI_Zip $zip Zip Compression Class - * @property CI_Utf8 $utf8 Provides support for UTF-8 environments + * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them. Memory consumption can also be displayed. + * @property CI_Calendar $calendar This class enables the creation of calendars + * @property CI_Cache $cache Caching Class + * @property CI_Cart $cart Shopping Cart Class + * @property CI_Config $config This class contains functions that enable config files to be managed + * @property CI_Controller $controller This class object is the super class that every library in CodeIgniter will be assigned to + * @property CI_DB_forge $dbforge Database Forge Class + * @property CI_DB_pdo_driver|CI_DB_mysqli_driver|CI_DB_query_builder|CI_DB_driver $db This is the platform-independent base Query Builder implementation class + * @property CI_DB_utility $dbutil Database Utility Class + * @property CI_Driver_Library $driver Driver Library Class + * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP + * @property CI_Encrypt $encrypt Provides two-way keyed encoding using Mcrypt + * @property CI_Encryption $encryption Provides two-way keyed encryption via PHP's MCrypt and/or OpenSSL extensions + * @property CI_Exceptions $exceptions Exceptions Class + * @property CI_Form_validation $form_validation Form Validation Class + * @property CI_FTP $ftp FTP Class + * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking + * @property CI_Image_lib $image_lib Image Manipulation class + * @property CI_Input $input Pre-processes global input data for security + * @property CI_Javascript $javascript Javascript Class + * @property CI_Jquery $jquery Jquery Class + * @property CI_Lang $lang Language Class + * @property CI_Loader $load Loads framework components + * @property CI_Log $log Logging Class + * @property CI_Migration $migration All migrations should implement this, forces up() and down() and gives access to the CI super-global + * @property CI_Model $model CodeIgniter Model Class + * @property CI_Output $output Responsible for sending final output to the browser + * @property CI_Pagination $pagination Pagination Class + * @property CI_Parser $parser Parser Class + * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data in order to help with debugging and optimization. + * @property CI_Router $router Parses URIs and determines routing + * @property CI_Security $security Security Class + * @property CI_Session $session Session Class + * @property CI_Table $table Lets you create tables manually or from database result objects, or arrays + * @property CI_Trackback $trackback Trackback Sending/Receiving Class + * @property CI_Typography $typography Typography Class + * @property CI_Unit_test $unit Simple testing class + * @property CI_Upload $upload File Uploading Class + * @property CI_URI $uri Parses URIs and determines routing + * @property CI_User_agent $agent Identifies the platform, browser, robot, or mobile device of the browsing agent + * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class + * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class + * @property CI_Zip $zip Zip Compression Class + * @property CI_Utf8 $utf8 Provides support for UTF-8 environments */ class HungNG_Custom_Based_model extends CI_Model { @@ -112,19 +112,19 @@ class HungNG_Custom_Based_model extends CI_Model public function __construct() { parent::__construct(); - $this->db = $this->load->database('default', true, true); - $this->tableName = ''; + $this->db = $this->load->database('default', true, true); + $this->tableName = ''; $this->primary_key = 'id'; - $this->created_at = 'created_at'; - $this->updated_at = 'updated_at'; - $this->deleted_at = 'deleted_at'; - $this->is_not = ' !='; - $this->or_higher = ' >='; - $this->is_higher = ' >'; - $this->or_smaller = ' <='; - $this->is_smaller = ' <'; - $this->start_time = ' 00:00:00'; - $this->end_time = ' 23:59:59'; + $this->created_at = 'created_at'; + $this->updated_at = 'updated_at'; + $this->deleted_at = 'deleted_at'; + $this->is_not = ' !='; + $this->or_higher = ' >='; + $this->is_higher = ' >'; + $this->or_smaller = ' <='; + $this->is_smaller = ' <'; + $this->start_time = ' 00:00:00'; + $this->end_time = ' 23:59:59'; } /** @@ -615,7 +615,7 @@ public function request_builder($search) } } if ($field === 'sort') { - $sort = (strpos($value, '-') === false) ? 'DESC' : 'ASC'; + $sort = (strpos($value, '-') === false) ? 'DESC' : 'ASC'; $column = (strpos($value, '-') === false) ? $value : substr($value, 1); if ($this->db->field_exists($column, $this->tableName)) { $this->db->order_by($this->tableName . '.' . $column, $sort); diff --git a/hungng/HungNG_ORM_Model.php b/hungng/HungNG_ORM_Model.php index a8066ec..4c380cd 100644 --- a/hungng/HungNG_ORM_Model.php +++ b/hungng/HungNG_ORM_Model.php @@ -194,7 +194,7 @@ class HungNG_ORM_Model extends CI_Model implements ArrayAccess /** * Constructor */ - function __construct() + public function __construct() { /* Database Connection Setting */ // Master @@ -208,7 +208,7 @@ function __construct() $this->_db = self::$_dbCaches[$this->database]; } else { // CI Database Configuration - $this->_db = get_instance()->load->database($this->database, true); + $this->_db = get_instance()->load->database($this->database, true); self::$_dbCaches[$this->database] = $this->_db; } } else { @@ -230,7 +230,7 @@ function __construct() $this->_dbr = self::$_dbrCaches[$this->databaseRead]; } else { // CI Database Configuration - $this->_dbr = get_instance()->load->database($this->databaseRead, true); + $this->_dbr = get_instance()->load->database($this->databaseRead, true); self::$_dbrCaches[$this->databaseRead] = $this->_dbr; } } else { @@ -793,7 +793,7 @@ public function batchUpdate(array $dataSet, $withAll = false, $maxLength = null, { $maxLength = $maxLength ? : 4 * 1024 * 1024; - $count = 0; + $count = 0; $sqlBatch = ''; foreach ($dataSet as $key => &$each) { @@ -828,9 +828,9 @@ public function batchUpdate(array $dataSet, $withAll = false, $maxLength = null, // use multiple SQL line in one query, but allows if the multi-line query is behind a single query. if (($count == 0 && $sqlBatch) || strlen($sqlBatch) >= $maxLength) { // Each batch of query - $result = $this->_db->query($sqlBatch); + $result = $this->_db->query($sqlBatch); $sqlBatch = ""; - $count = ($result) ? $count + 1 : $count; + $count = ($result) ? $count + 1 : $count; } // Keep Combining query @@ -1109,10 +1109,10 @@ public function save($runValidation = true) // Change this ActiveRecord to update mode if ($result) { // ORM handling - $this->_readProperties = $this->_writeProperties; - $insertID = $this->getLastInsertID(); + $this->_readProperties = $this->_writeProperties; + $insertID = $this->getLastInsertID(); $this->_readProperties[$this->primaryKey] = $insertID; - $this->_selfCondition = $insertID; + $this->_selfCondition = $insertID; // Event $this->afterSave(true, $this->_readProperties); // Reset properties @@ -1229,9 +1229,9 @@ protected function _relationship($modelName, $relationship, $foreignKey = null, // Original CodeIgniter 3 model loader get_instance()->load->model($modelName); // Fix the modelName if it has path - $path = explode('/', $modelName); + $path = explode('/', $modelName); $modelName = count($path) > 1 ? end($path) : $modelName; - $model = get_instance()->$modelName; + $model = get_instance()->$modelName; } $libClass = __CLASS__; @@ -1243,7 +1243,7 @@ protected function _relationship($modelName, $relationship, $foreignKey = null, // Keys $foreignKey = ($foreignKey) ? $foreignKey : $this->primaryKey; - $localKey = ($localKey) ? $localKey : $this->primaryKey; + $localKey = ($localKey) ? $localKey : $this->primaryKey; $query = $model->find() ->where($foreignKey, $this->$localKey); @@ -1273,7 +1273,7 @@ protected function _getRelationshipProperty($method) $query = call_user_func_array([$this, $method], []); // Extract query builder injection property - $modelName = isset($query->modelName) ? $query->modelName : null; + $modelName = isset($query->modelName) ? $query->modelName : null; $relationship = isset($query->relationship) ? $query->relationship : null; if (!$modelName || !$relationship) {