diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4c27382..39f5272 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,28 +2,28 @@ name: Testing CodeIgniter Basic Helper by HungNG on: [ push, pull_request ] jobs: - build: - strategy: - matrix: - operating-system: [ 'ubuntu-latest', 'ubuntu-20.04', 'ubuntu-22.04', 'macos-latest', 'macos-11', 'macos-12' ] - php-versions: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] - runs-on: ${{ matrix.operating-system }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 # From https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, intl, curl, json, openssl, iconv, bcmath, xml - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install dependencies - run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader \ No newline at end of file + build: + strategy: + matrix: + operating-system: [ 'ubuntu-latest', 'ubuntu-20.04', 'ubuntu-22.04' ] + php-versions: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + runs-on: ${{ matrix.operating-system }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 # From https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, curl, json, openssl, iconv, bcmath, xml + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader diff --git a/composer.json b/composer.json index f6bd4b5..cb18d4e 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "nguyenanhung/basic-miscellaneous-helper": "^2.0 || ^1.0" }, "require-dev": { - "nguyenanhung/my-debug": "^3.0 || ^2.0", + "nguyenanhung/my-debug": "^4.0 || ^3.0 || ^2.0", "nguyenanhung/nanoid-helper": "^2.0 || ^1.0", "nguyenanhung/json-helper": "^2.0 || ^1.0", "nguyenanhung/image": "^3.0 || ^2.0 || ^1.0", diff --git a/helpers/alphaid_helper.php b/helpers/alphaid_helper.php index 823b134..456d2b0 100644 --- a/helpers/alphaid_helper.php +++ b/helpers/alphaid_helper.php @@ -1,4 +1,5 @@ diff --git a/helpers/array_helper.php b/helpers/array_helper.php index 3448d17..472b276 100644 --- a/helpers/array_helper.php +++ b/helpers/array_helper.php @@ -1,4 +1,5 @@ @@ -20,14 +21,14 @@ */ function arrayToObject($array = array()) { - if (!is_array($array)) { + if ( ! is_array($array)) { return $array; } $object = new stdClass(); $countArray = count($array); if ($countArray > 0) { foreach ($array as $name => $value) { - if (!empty($name)) { + if ( ! empty($name)) { $object->$name = arrayToObject($value); } } @@ -36,13 +37,13 @@ function arrayToObject($array = array()) return false; } } -if (!function_exists('arrayToXml')) { +if ( ! function_exists('arrayToXml')) { /** * Function arrayToXml * - * @param array|mixed $array - * @param string $namespace - * @param mixed $file_output + * @param array|mixed $array + * @param string $namespace + * @param mixed $file_output * * @return bool|string|null * @throws \Exception @@ -53,15 +54,18 @@ function arrayToObject($array = array()) function arrayToXml($array = array(), $namespace = '', $file_output = null) { if (class_exists('SimpleXMLElement')) { - $xml_object = new SimpleXMLElement("<" . $namespace . ">"); // creating object of SimpleXMLElement + $xml_object = new SimpleXMLElement( + "<" . $namespace . ">" + ); // creating object of SimpleXMLElement convertArrayToXml($array, $xml_object); // function call to convert array to xml - $xml_file = $file_output !== null ? $xml_object->asXML($file_output) : $xml_object->asXML(); // saving generated xml file - return !empty($xml_file) ? $xml_file : null; + $xml_file = $file_output !== null ? $xml_object->asXML($file_output) : $xml_object->asXML( + ); // saving generated xml file + return ! empty($xml_file) ? $xml_file : null; } return null; } } -if (!function_exists('convertArrayToXml')) { +if ( ! function_exists('convertArrayToXml')) { /** * Function convertArrayToXml * @@ -76,7 +80,7 @@ function convertArrayToXml($array, &$SimpleXMLElement) { foreach ($array as $key => $value) { if (is_array($value)) { - if (!is_numeric($key)) { + if ( ! is_numeric($key)) { $subNode = $SimpleXMLElement->addChild((string)$key); } else { $subNode = $SimpleXMLElement->addChild("item" . $key); @@ -88,7 +92,7 @@ function convertArrayToXml($array, &$SimpleXMLElement) } } } -if (!function_exists('removeArrayElementWithValue')) { +if ( ! function_exists('removeArrayElementWithValue')) { /** * Function removeArrayElementWithValue - Loại bỏ 1 giá trị trong array theo key và value * @@ -111,7 +115,7 @@ function removeArrayElementWithValue($array, $key, $value) return $array; } } -if (!function_exists('arrayRecursiveDiff')) { +if ( ! function_exists('arrayRecursiveDiff')) { /** * Function arrayRecursiveDiff - Diff 2 array bằng đệ quy * @@ -143,7 +147,7 @@ function arrayRecursiveDiff($aArray1, $aArray2) return $aReturn; } } -if (!function_exists('arrayIsAssoc')) { +if ( ! function_exists('arrayIsAssoc')) { /** * Function arrayIsAssoc - Detects if the given value is an associative array. * @@ -167,7 +171,7 @@ function arrayRecursiveDiff($aArray1, $aArray2) * // bool(true) * ``` * - * @param array $array + * @param array $array * Any type of array. * * @return bool @@ -175,13 +179,13 @@ function arrayRecursiveDiff($aArray1, $aArray2) */ function arrayIsAssoc($array) { - if (!is_array($array) || $array === array()) { + if ( ! is_array($array) || $array === array()) { return false; } return array_keys($array) !== range(0, count($array) - 1); } } -if (!function_exists('arrayFirstElement')) { +if ( ! function_exists('arrayFirstElement')) { /** * Function arrayFirstElement - Returns the first element of an array. * @@ -206,7 +210,7 @@ function arrayIsAssoc($array) * // bar * ``` * - * @param array $array + * @param array $array * The concerned array. * * @return mixed @@ -218,7 +222,7 @@ function arrayFirstElement($array) return $array[array_keys($array)[0]]; } } -if (!function_exists('arrayLastElement')) { +if ( ! function_exists('arrayLastElement')) { /** * Function arrayLastElement - Returns the last element of an array. * @@ -243,7 +247,7 @@ function arrayFirstElement($array) * // qux * ``` * - * @param array $array + * @param array $array * The concerned array. * * @return mixed @@ -254,7 +258,7 @@ function arrayLastElement($array) return $array[array_keys($array)[count($array) - 1]]; } } -if (!function_exists('arrayGetElement')) { +if ( ! function_exists('arrayGetElement')) { /** * Function arrayGetElement - Gets a value in an array by dot notation for the keys. * @@ -281,9 +285,9 @@ function arrayLastElement($array) * // foobar * ``` * - * @param string $key + * @param string $key * The key by dot notation. - * @param array $array + * @param array $array * The array to search in. * * @return mixed @@ -295,7 +299,7 @@ function arrayGetElement($key, $array) $keys = explode('.', $key); while (count($keys) >= 1) { $k = array_shift($keys); - if (!isset($array[$k])) { + if ( ! isset($array[$k])) { return null; } if (count($keys) === 0) { @@ -307,7 +311,7 @@ function arrayGetElement($key, $array) return null; } } -if (!function_exists('arraySetElement')) { +if ( ! function_exists('arraySetElement')) { /** * Function arraySetElement - Sets a value in an array using the dot notation. * @@ -359,11 +363,11 @@ function arrayGetElement($key, $array) * // ) * ``` * - * @param string $key + * @param string $key * The key to set using dot notation. - * @param mixed $value + * @param mixed $value * The value to set on the specified key. - * @param array $array + * @param array $array * The concerned array. * * @return bool @@ -371,15 +375,15 @@ function arrayGetElement($key, $array) */ function arraySetElement($key, $value, &$array) { - if (is_string($key) && !empty($key)) { + if (is_string($key) && ! empty($key)) { $keys = explode('.', $key); $arrTmp = &$array; while (count($keys) >= 1) { $k = array_shift($keys); - if (!is_array($arrTmp)) { + if ( ! is_array($arrTmp)) { $arrTmp = array(); } - if (!isset($arrTmp[$k])) { + if ( ! isset($arrTmp[$k])) { $arrTmp[$k] = array(); } if (count($keys) === 0) { @@ -392,7 +396,7 @@ function arraySetElement($key, $value, &$array) return false; } } -if (!function_exists('to_array')) { +if ( ! function_exists('to_array')) { /** * Function to_array - Converts a string or an object to an array. * @@ -429,7 +433,7 @@ function arraySetElement($key, $value, &$array) * // ) * ``` * - * @param string|object $var + * @param string|object $var * String or object. * * @return array|null @@ -447,11 +451,11 @@ function to_array($var) return null; } } -if (!function_exists('arrayToAttributes')) { +if ( ! function_exists('arrayToAttributes')) { /** * Takes an array of attributes and turns it into a string for an html tag * - * @param array $attr + * @param array $attr * * @return string */ diff --git a/helpers/assets_helper.php b/helpers/assets_helper.php index 69e0be1..ea79ecb 100644 --- a/helpers/assets_helper.php +++ b/helpers/assets_helper.php @@ -1,4 +1,5 @@ @@ -33,11 +34,11 @@ function assets_url($uri = '', $protocol = null) return trim($uri); } } -if (!function_exists('static_url')) { +if ( ! function_exists('static_url')) { /** * Function static_url * - * @param string $uri + * @param string $uri * * @return string * @author : 713uk13m @@ -59,12 +60,12 @@ function static_url($uri = '') return trim($uri); } } -if (!function_exists('templates_url')) { +if ( ! function_exists('templates_url')) { /** * Function templates_url * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -85,12 +86,12 @@ function templates_url($uri = '', $protocol = null) return trim($uri); } } -if (!function_exists('editor_url')) { +if ( ! function_exists('editor_url')) { /** * Function editor_url * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -103,12 +104,12 @@ function editor_url($uri = '', $protocol = null) return assets_url($uri, $protocol); } } -if (!function_exists('favicon_url')) { +if ( ! function_exists('favicon_url')) { /** * Function favicon_url * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -121,12 +122,12 @@ function favicon_url($uri = '', $protocol = null) return assets_url($uri, $protocol); } } -if (!function_exists('fav_url')) { +if ( ! function_exists('fav_url')) { /** * Function fav_url - alias of favicon_url * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -139,7 +140,7 @@ function fav_url($uri = '', $protocol = null) return assets_url($uri, $protocol); } } -if (!function_exists('favicon_html_tag')) { +if ( ! function_exists('favicon_html_tag')) { /** * Function favicon_html_tag * @@ -155,11 +156,11 @@ function favicon_html_tag($baseUrl = '') return (new \nguyenanhung\CodeIgniter\BasicHelper\Favicon())->faviconHtml($baseUrl); } } -if (!function_exists('storage_url')) { +if ( ! function_exists('storage_url')) { /** * Function storage_url * - * @param string $uri + * @param string $uri * * @return string * @author : 713uk13m @@ -181,12 +182,12 @@ function storage_url($uri = '') return $uri; } } -if (!function_exists('public_storage_tmp_url')) { +if ( ! function_exists('public_storage_tmp_url')) { /** * Function public_storage_tmp_url * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -207,11 +208,11 @@ function public_storage_tmp_url($uri = '', $protocol = null) return trim($uri); } } -if (!function_exists('go_url')) { +if ( ! function_exists('go_url')) { /** * Function go_url * - * @param string $uri + * @param string $uri * * @return string * @author : 713uk13m @@ -227,12 +228,12 @@ function go_url($uri = '') return $uri; } } -if (!function_exists('assets_mobile')) { +if ( ! function_exists('assets_mobile')) { /** * Function assets_mobile * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -245,14 +246,14 @@ function assets_mobile($uri = '', $protocol = null) return assets_url($uri, $protocol); } } -if (!function_exists('assets_themes')) { +if ( ! function_exists('assets_themes')) { /** * Function assets_themes * - * @param string $themes - * @param string $uri - * @param string $folder - * @param string|null $protocol + * @param string $themes + * @param string $uri + * @param string $folder + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -278,14 +279,14 @@ function assets_themes($themes = '', $uri = '', $folder = 'yes', $protocol = nul return assets_url($uri, $protocol); } } -if (!function_exists('assets_themes_dashboard')) { +if ( ! function_exists('assets_themes_dashboard')) { /** * Function assets_themes_dashboard * - * @param string $themes - * @param string $uri - * @param string $folder - * @param string|null $protocol + * @param string $themes + * @param string $uri + * @param string $folder + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -297,14 +298,14 @@ function assets_themes_dashboard($themes = '', $uri = '', $folder = 'yes', $prot return assets_themes($themes, $uri, $folder, $protocol); } } -if (!function_exists('assets_themes_comingsoon')) { +if ( ! function_exists('assets_themes_comingsoon')) { /** * Function assets_themes_comingsoon * - * @param string $themes - * @param string $uri - * @param string $folder - * @param string|null $protocol + * @param string $themes + * @param string $uri + * @param string $folder + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -316,14 +317,14 @@ function assets_themes_comingsoon($themes = '', $uri = '', $folder = '', $protoc return assets_themes($themes, $uri, $folder, $protocol); } } -if (!function_exists('assets_themes_error')) { +if ( ! function_exists('assets_themes_error')) { /** * Function assets_themes_error * - * @param string $themes - * @param string $uri - * @param string $folder - * @param string|null $protocol + * @param string $themes + * @param string $uri + * @param string $folder + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -335,12 +336,12 @@ function assets_themes_error($themes = '', $uri = '', $folder = 'yes', $protocol return assets_themes($themes, $uri, $folder, $protocol); } } -if (!function_exists('assets_themes_metronic')) { +if ( ! function_exists('assets_themes_metronic')) { /** * Function assets_themes_metronic * - * @param string $uri - * @param string|null $protocol + * @param string $uri + * @param string|null $protocol * * @return string * @author : 713uk13m @@ -352,11 +353,11 @@ function assets_themes_metronic($uri = '', $protocol = null) return assets_themes('metronic', $uri, 'yes', $protocol); } } -if (!function_exists('cdn_js_url')) { +if ( ! function_exists('cdn_js_url')) { /** * Function cdn_js_url * - * @param string $uri + * @param string $uri * * @return string * @author : 713uk13m @@ -369,11 +370,11 @@ function cdn_js_url($uri = '') return $cdnJs . trim($uri); } } -if (!function_exists('google_fonts_url')) { +if ( ! function_exists('google_fonts_url')) { /** * Function google_fonts_url * - * @param string $family + * @param string $family * * @return string * @author : 713uk13m @@ -386,11 +387,11 @@ function google_fonts_url($family = '') return $fonts . trim($family); } } -if (!function_exists('bootstrapcdn_url')) { +if ( ! function_exists('bootstrapcdn_url')) { /** * Function bootstrapcdn_url * - * @param string $uri + * @param string $uri * * @return string * @author : 713uk13m diff --git a/helpers/blogspot_helper.php b/helpers/blogspot_helper.php index 8841007..586354b 100644 --- a/helpers/blogspot_helper.php +++ b/helpers/blogspot_helper.php @@ -1,4 +1,5 @@ get_data_chart($item_list, $valueGet, $total); } } -if (!function_exists('bear_framework_default_get_data_chart_report')) { +if ( ! function_exists('bear_framework_default_get_data_chart_report')) { function bear_framework_default_get_data_chart_report($item_list, $valueGet) { return (new \nguyenanhung\CodeIgniter\BasicHelper\ChartRender())->get_data_chart_report($item_list, $valueGet); diff --git a/helpers/common_helper.php b/helpers/common_helper.php index 6a47d80..5e622f7 100644 --- a/helpers/common_helper.php +++ b/helpers/common_helper.php @@ -1,4 +1,5 @@ ' . $author['name'] . ''; } } -if (!function_exists('smart_bear_copyright_powered_line')) { +if ( ! function_exists('smart_bear_copyright_powered_line')) { function smart_bear_copyright_powered_line() { $helper = new \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper(); @@ -29,24 +30,24 @@ function smart_bear_copyright_powered_line() return 'Powered by ' . $author['name'] . ''; } } -if (!function_exists('smart_bear_basic_helper_version')) { +if ( ! function_exists('smart_bear_basic_helper_version')) { function smart_bear_basic_helper_version() { return \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper::version(); } } -if (!function_exists('smart_bear_basic_helper_author')) { +if ( ! function_exists('smart_bear_basic_helper_author')) { function smart_bear_basic_helper_author() { $helper = new \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper(); return $helper->getAuthor(); } } -if (!function_exists('isEmpty')) { +if ( ! function_exists('isEmpty')) { /** * Function isEmpty * - * @param mixed $input + * @param mixed $input * * @return bool * @author : 713uk13m @@ -69,11 +70,11 @@ function isEmpty($input = '') return true; } } -if (!function_exists('defaultCompressHtmlOutput')) { +if ( ! function_exists('defaultCompressHtmlOutput')) { /** * Function defaultCompressHtmlOutput * - * @param mixed $html + * @param mixed $html * * @return array|string|string[]|null * @author : 713uk13m @@ -95,7 +96,7 @@ function defaultCompressHtmlOutput($html = '') return preg_replace($search, $replace, $html); } } -if (!function_exists('generateRandomUniqueId')) { +if ( ! function_exists('generateRandomUniqueId')) { function generateRandomUniqueId() { $uniqid = uniqid('-bear-', true); @@ -103,7 +104,7 @@ function generateRandomUniqueId() return date('Ymd') . '-' . generate_uuid_v4() . $uniqid; } } -if (!function_exists('generateRandomNanoUniqueId')) { +if ( ! function_exists('generateRandomNanoUniqueId')) { function generateRandomNanoUniqueId() { $uniqid = uniqid('-bear-', true); @@ -111,11 +112,11 @@ function generateRandomNanoUniqueId() return date('Ymd') . '-' . randomNanoId(16) . $uniqid; } } -if (!function_exists('__get_error_message__')) { +if ( ! function_exists('__get_error_message__')) { /** * Function __get_error_message__ * - * @param \Exception|\Throwable $e + * @param \Exception|\Throwable $e * * @return string * @author : 713uk13m @@ -124,14 +125,15 @@ function generateRandomNanoUniqueId() */ function __get_error_message__($e) { - return "Error Code: " . $e->getCode() . " - File: " . $e->getFile() . " - Line: " . $e->getLine() . " - Message: " . $e->getMessage(); + return "Error Code: " . $e->getCode() . " - File: " . $e->getFile() . " - Line: " . $e->getLine( + ) . " - Message: " . $e->getMessage(); } } -if (!function_exists('__get_error_trace__')) { +if ( ! function_exists('__get_error_trace__')) { /** * Function __get_error_trace__ * - * @param \Exception|\Throwable $e + * @param \Exception|\Throwable $e * * @return string * @author : 713uk13m diff --git a/helpers/database_helper.php b/helpers/database_helper.php index d5a9774..ecf7c94 100644 --- a/helpers/database_helper.php +++ b/helpers/database_helper.php @@ -1,4 +1,5 @@ @@ -40,5 +41,4 @@ function generate_list_id_with_parent_id($allSubId, $parentId, $field = 'id') } return $parentId; } - } diff --git a/helpers/date_helper.php b/helpers/date_helper.php index 3d4f885..1697eab 100644 --- a/helpers/date_helper.php +++ b/helpers/date_helper.php @@ -1,4 +1,5 @@ @@ -28,7 +29,7 @@ function dayFloor($beginTime = '', $endTime = '') return (int)floor($floor / (60 * 60 * 24)); } } -if (!function_exists('getZuluTime')) { +if ( ! function_exists('getZuluTime')) { /** * Function getZuluTime * @@ -49,7 +50,7 @@ function getZuluTime() } } } -if (!function_exists('iso_8601_utc_time')) { +if ( ! function_exists('iso_8601_utc_time')) { /** * Function iso_8601_utc_time * @@ -63,13 +64,13 @@ function iso_8601_utc_time() return getZuluTime(); } } -if (!function_exists('getYesterday')) { +if ( ! function_exists('getYesterday')) { function getYesterday($format = 'Y-m-d') { return date($format, strtotime("-1 days")); } } -if (!function_exists('smart_bear_date_range')) { +if ( ! function_exists('smart_bear_date_range')) { function smart_bear_date_range($first, $last, $step = '+1 day', $format = 'Y-m-d') { $dates = array(); @@ -82,7 +83,7 @@ function smart_bear_date_range($first, $last, $step = '+1 day', $format = 'Y-m-d return $dates; } } -if (!function_exists('format_datetime_vn')) { +if ( ! function_exists('format_datetime_vn')) { function format_datetime_vn($datetime = '', $type = 'datetime') { if (empty($datetime)) { @@ -99,7 +100,7 @@ function format_datetime_vn($datetime = '', $type = 'datetime') return date('d-m-Y H:i:s', $timestamp); } } -if (!function_exists('get_start_and_end_date_for_week')) { +if ( ! function_exists('get_start_and_end_date_for_week')) { /** * Function get_start_and_end_date_for_week * diff --git a/helpers/debug_helper.php b/helpers/debug_helper.php index f642137..9b9f403 100644 --- a/helpers/debug_helper.php +++ b/helpers/debug_helper.php @@ -1,5 +1,6 @@ '; @@ -9,7 +10,7 @@ function dd($var) die; } } -if (!function_exists('ddd')) { +if ( ! function_exists('ddd')) { function ddd($str) { echo "
";
@@ -18,7 +19,7 @@ function ddd($str)
 		die;
 	}
 }
-if (!function_exists('dump')) {
+if ( ! function_exists('dump')) {
 	function dump($str = '')
 	{
 		echo "
";
diff --git a/helpers/download_helper.php b/helpers/download_helper.php
index 68aae28..a8dca70 100644
--- a/helpers/download_helper.php
+++ b/helpers/download_helper.php
@@ -1,4 +1,5 @@
 
@@ -22,14 +23,16 @@
 	 */
 	function widget_facebook_comments($url = '', $width = '', $num_posts = 5)
 	{
-		return '
'; + return '
'; } } -if (!function_exists('widget_facebook_share_button')) { +if ( ! function_exists('widget_facebook_share_button')) { /** * Function widget_facebook_share_button * - * @param string $url + * @param string $url * * @return string * @author : 713uk13m @@ -41,11 +44,11 @@ function widget_facebook_share_button($url = '') return '
'; } } -if (!function_exists('widget_facebook_like_button')) { +if ( ! function_exists('widget_facebook_like_button')) { /** * Function widget_facebook_like_button * - * @param string $url + * @param string $url * * @return string * @author : 713uk13m @@ -54,14 +57,16 @@ function widget_facebook_share_button($url = '') */ function widget_facebook_like_button($url = '') { - return '
'; + return '
'; } } -if (!function_exists('widget_facebook_save_button')) { +if ( ! function_exists('widget_facebook_save_button')) { /** * Function widget_facebook_save_button * - * @param string $url + * @param string $url * * @return string * @author : 713uk13m @@ -73,12 +78,12 @@ function widget_facebook_save_button($url = '') return '
'; } } -if (!function_exists('widget_facebook_script_init')) { +if ( ! function_exists('widget_facebook_script_init')) { /** * Function widget_facebook_script_init * - * @param string $appId - * @param string $version + * @param string $appId + * @param string $version * * @return string * @author : 713uk13m @@ -90,11 +95,15 @@ function widget_facebook_script_init($appId = '', $version = 'v14.0') if (empty($version)) { $version = 'v14.0'; } - $url = 'https://connect.facebook.net/vi_VN/sdk.js#xfbml=1&version=' . trim($version) . '&appId=' . trim($appId) . '&autoLogAppEvents=1'; - return '
'; + $url = 'https://connect.facebook.net/vi_VN/sdk.js#xfbml=1&version=' . trim($version) . '&appId=' . trim( + $appId + ) . '&autoLogAppEvents=1'; + return '
'; } } -if (!function_exists('widget_facebook_div_init')) { +if ( ! function_exists('widget_facebook_div_init')) { /** * Function widget_facebook_div_init * diff --git a/helpers/file_helper.php b/helpers/file_helper.php index 8230dc5..9914836 100644 --- a/helpers/file_helper.php +++ b/helpers/file_helper.php @@ -1,4 +1,5 @@ @@ -133,7 +137,7 @@ function genarateFileIndex($file_path = '', $file_name = 'index.html') if (function_exists('log_message') && function_exists('write_file')) { if ($file_path !== '') { if (is_dir($file_path) === false) { - if (!mkdir($file_path) && !is_dir($file_path)) { + if ( ! mkdir($file_path) && ! is_dir($file_path)) { throw new RuntimeException(sprintf('Directory "%s" was not created', $file_path)); } log_message('debug', 'Genarate new Folder: ' . $file_path); @@ -160,12 +164,12 @@ function genarateFileIndex($file_path = '', $file_name = 'index.html') return false; } } -if (!function_exists('genarateFileHtaccess')) { +if ( ! function_exists('genarateFileHtaccess')) { /** * Function genarateFileHtaccess * - * @param string $file_path - * @param string $file_name + * @param string $file_path + * @param string $file_name * * @return bool * @author : 713uk13m @@ -178,7 +182,7 @@ function genarateFileHtaccess($file_path = '', $file_name = '.htaccess') if ($file_path !== '') { // SET file Path if (is_dir($file_path) === false) { - if (!mkdir($file_path) && !is_dir($file_path)) { + if ( ! mkdir($file_path) && ! is_dir($file_path)) { throw new RuntimeException(sprintf('Directory "%s" was not created', $file_path)); } log_message('debug', 'Genarate new Folder: ' . $file_path); @@ -204,12 +208,12 @@ function genarateFileHtaccess($file_path = '', $file_name = '.htaccess') return false; } } -if (!function_exists('genarateFileReadme')) { +if ( ! function_exists('genarateFileReadme')) { /** * Function genarateFileReadme * - * @param string $file_path - * @param string $file_name + * @param string $file_path + * @param string $file_name * * @return bool * @author : 713uk13m @@ -221,7 +225,7 @@ function genarateFileReadme($file_path = '', $file_name = 'README.md') if (function_exists('log_message') && function_exists('write_file')) { if ($file_path !== '') { if (is_dir($file_path) === false) { - if (!mkdir($file_path) && !is_dir($file_path)) { + if ( ! mkdir($file_path) && ! is_dir($file_path)) { throw new RuntimeException(sprintf('Directory "%s" was not created', $file_path)); } log_message('debug', 'Genarate new Folder: ' . $file_path); @@ -247,11 +251,11 @@ function genarateFileReadme($file_path = '', $file_name = 'README.md') return false; } } -if (!function_exists('makeNewFolder')) { +if ( ! function_exists('makeNewFolder')) { /** * Function makeNewFolder * - * @param string $folderPath + * @param string $folderPath * * @return bool * @author : 713uk13m @@ -264,7 +268,7 @@ function makeNewFolder($folderPath = '') return false; } if (is_dir($folderPath) === false) { - if (!mkdir($folderPath) && !is_dir($folderPath)) { + if ( ! mkdir($folderPath) && ! is_dir($folderPath)) { throw new RuntimeException(sprintf('Directory "%s" was not created', $folderPath)); } genarateFileIndex($folderPath); @@ -277,11 +281,11 @@ function makeNewFolder($folderPath = '') return false; } } -if (!function_exists('new_folder')) { +if ( ! function_exists('new_folder')) { /** * Function new_folder * - * @param string $folder + * @param string $folder * * @return bool * @author : 713uk13m @@ -293,7 +297,7 @@ function new_folder($folder = '') return makeNewFolder($folder); } } -if (!function_exists('scan_folder')) { +if ( ! function_exists('scan_folder')) { /** * Function scan_folder - Quét và lấy ra danh sách các thông tin dữ liệu trong folder * @@ -325,7 +329,7 @@ function scan_folder($path, $ignoreFiles = array()) } } } -if (!function_exists('getAllFileSizeInFolder')) { +if ( ! function_exists('getAllFileSizeInFolder')) { /** * Function getAllFileSizeInFolder - Get all File size in Folder * @@ -364,7 +368,7 @@ function getAllFileSizeInFolder($path) return round($size / 1024 / 1024, 2); } } -if (!function_exists('getAllFileInFolder')) { +if ( ! function_exists('getAllFileInFolder')) { /** * Function getAllFileInFolder - Get all File in Folder * diff --git a/helpers/form_helper.php b/helpers/form_helper.php index 7d28beb..26a0061 100644 --- a/helpers/form_helper.php +++ b/helpers/form_helper.php @@ -1,4 +1,5 @@ load->driver('cache', array('adapter' => 'file', 'backup' => 'dummy')); - if (!$res = $cms->cache->get($file)) { + if ( ! $res = $cms->cache->get($file)) { $respond = sendSimpleGetRequest($url); $res = json_decode($respond, false); $cms->cache->save($file, $res, 86400); @@ -38,7 +39,7 @@ function bear_framework_gravatar_init($username = 'nguyenanhung') return $res; } } -if (!function_exists('bear_framework_show_gravatar')) { +if ( ! function_exists('bear_framework_show_gravatar')) { /** * Function bear_framework_show_gravatar * @@ -52,6 +53,8 @@ function bear_framework_gravatar_init($username = 'nguyenanhung') */ function bear_framework_show_gravatar($username = 'nguyenanhung', $size = 300) { - return bear_framework_gravatar_init($username)->entry[0]->thumbnailUrl . '?' . http_build_query(array('size' => $size)); + return bear_framework_gravatar_init($username)->entry[0]->thumbnailUrl . '?' . http_build_query( + array('size' => $size) + ); } } diff --git a/helpers/html_helper.php b/helpers/html_helper.php index 0d7fa12..f23b82b 100644 --- a/helpers/html_helper.php +++ b/helpers/html_helper.php @@ -1,4 +1,5 @@ \n\n\n\n\n\n"; } } -if (!function_exists('meta_property')) { +if ( ! function_exists('meta_property')) { /** * Function meta_property * - * @param string|array $property - * @param string $content - * @param string $type - * @param string $newline + * @param string|array $property + * @param string $content + * @param string $type + * @param string $newline * * @return string * @author : 713uk13m @@ -39,7 +40,7 @@ function meta_property($property = '', $content = '', $type = 'property', $newli { // Since we allow the data to be passes as a string, a simple array // or a multidimensional one, we need to do a little prepping. - if (!is_array($property)) { + if ( ! is_array($property)) { $property = array( array( 'property' => $property, @@ -64,7 +65,7 @@ function meta_property($property = '', $content = '', $type = 'property', $newli return $str; } } -if (!function_exists('tachPage')) { +if ( ! function_exists('tachPage')) { /** * Function tachPage * @@ -85,7 +86,7 @@ function tachPage($input) return $output[1]; } } -if (!function_exists('stripHtmlTag')) { +if ( ! function_exists('stripHtmlTag')) { /** * Function stripHtmlTag * @@ -112,13 +113,13 @@ function stripHtmlTag($str) return $strippedString; } } -if (!function_exists('strip_only_tags')) { +if ( ! function_exists('strip_only_tags')) { /** * Function strip_only_tags * * @param $str * @param $tags - * @param bool $stripContent + * @param bool $stripContent * * @return string|string[]|null * @author : 713uk13m @@ -133,7 +134,7 @@ function strip_only_tags($str, $tags, $stripContent = false) $content = ''; - if (!is_array($tags)) { + if ( ! is_array($tags)) { $tags = (mb_strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags)); if (end($tags) === '') { array_pop($tags); @@ -151,12 +152,12 @@ function strip_only_tags($str, $tags, $stripContent = false) return $str; } } -if (!function_exists('tracking_google_analytics')) { +if ( ! function_exists('tracking_google_analytics')) { /** * Function tracking_google_analytics * - * @param string $analytics_id - * @param string $analytics_mode + * @param string $analytics_id + * @param string $analytics_mode * * @return string * @author : 713uk13m @@ -182,11 +183,11 @@ function tracking_google_analytics($analytics_id = '', $analytics_mode = 'auto') return trim($html); } } -if (!function_exists('tracking_google_gtag_analytics_default')) { +if ( ! function_exists('tracking_google_gtag_analytics_default')) { /** * Function tracking_google_gtag_analytics_default * - * @param string $ID + * @param string $ID * * @return string * @author : 713uk13m @@ -199,7 +200,9 @@ function tracking_google_gtag_analytics_default($ID = '') return $ID; } $html = "" . PHP_EOL; - $html .= "" . PHP_EOL; + $html .= "" . PHP_EOL; $html .= "