Skip to content

Commit

Permalink
Release version 1.1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Dec 30, 2022
1 parent ca4affa commit 2492276
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Dưới đây là danh sách các Helper được hỗ trợ trong bộ thư vi
CSS, JS
- [x] Helper Function: `favicon_url`- Hàm lấy ra Assets Url, điều kiện tồn tại thư mục `assets/favicon/` trong thư mục `public/`. Trong trường hợp trong file `config.php` tồn tại biến `assets_version` sẽ tự động thêm version vào đằng sau các file
CSS, JS
- [x] Helper Function: `favicon_html_tag`- Hàm lấy ra đoạn HTML thể hiện Favicon dựa vào URL folder favicon đầu vào
- [x] Helper Function: `storage_url` - Need config `storage_url` item in config.php file. VD: `$config['storage_url'] = 'https://storage.nguyenanhung.com/';`
- [x] Helper Function: `go_url` - Need config `go_url` item in `config.php` file. VD: `$config['go_url'] = 'https://go.nguyenanhung.com/';`
- [x] Helper Function: `assets_mobile`
Expand Down
16 changes: 16 additions & 0 deletions helpers/assets_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ function favicon_url($uri = '', $protocol = null)
return assets_url($uri, $protocol);
}
}
if (!function_exists('favicon_html_tag')) {
/**
* Function favicon_html_tag
*
* @param $baseUrl
*
* @return string
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 30/12/2022 03:21
*/
function favicon_html_tag($baseUrl = '')
{
return (new \nguyenanhung\CodeIgniter\BasicHelper\Favicon())->faviconHtml($baseUrl);
}
}
if (!function_exists('storage_url')) {
/**
* Function storage_url
Expand Down
4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.1.7.1';
const LAST_MODIFIED = '2022-12-26';
const VERSION = '1.1.7.2';
const LAST_MODIFIED = '2022-12-30';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_EMAIL = '[email protected]';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
Expand Down
59 changes: 59 additions & 0 deletions src/Favicon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* Project codeigniter-basic-helper
* Created by PhpStorm
* User: 713uk13m <[email protected]>
* Copyright: 713uk13m <[email protected]>
* Date: 30/12/2022
* Time: 09:36
*/

namespace nguyenanhung\CodeIgniter\BasicHelper;

/**
* Class Favicon
*
* @package nguyenanhung\CodeIgniter\BasicHelper
* @author 713uk13m <[email protected]>
* @copyright 713uk13m <[email protected]>
*/
class Favicon extends BaseHelper
{
/**
* Function faviconHtml
*
* Function này hỗ trợ return ra 1 đoạn HTML dùng show Favicon, được build từ https://www.favicon-generator.org/
*
* @param $baseUrl
*
* @return string
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @time : 30/12/2022 00:06
*
* @see : https://www.favicon-generator.org/
*/
public function faviconHtml($baseUrl = '')
{
$baseUrl = trim($baseUrl) . '/';
$html = '<link rel="apple-touch-icon" sizes="57x57" href="' . $baseUrl . 'apple-icon-57x57.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="60x60" href="' . $baseUrl . 'apple-icon-60x60.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="72x72" href="' . $baseUrl . 'apple-icon-72x72.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="76x76" href="' . $baseUrl . 'apple-icon-76x76.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="114x114" href="' . $baseUrl . 'apple-icon-114x114.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="120x120" href="' . $baseUrl . 'apple-icon-120x120.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="144x144" href="' . $baseUrl . 'apple-icon-144x144.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="152x152" href="' . $baseUrl . 'apple-icon-152x152.png">' . PHP_EOL;
$html .= '<link rel="apple-touch-icon" sizes="180x180" href="' . $baseUrl . 'apple-icon-180x180.png">' . PHP_EOL;
$html .= '<link rel="icon" type="image/png" sizes="192x192" href="' . $baseUrl . 'android-icon-192x192.png">' . PHP_EOL;
$html .= '<link rel="icon" type="image/png" sizes="32x32" href="' . $baseUrl . 'favicon-32x32.png">' . PHP_EOL;
$html .= '<link rel="icon" type="image/png" sizes="96x96" href="' . $baseUrl . 'favicon-96x96.png">' . PHP_EOL;
$html .= '<link rel="icon" type="image/png" sizes="16x16" href="' . $baseUrl . 'favicon-16x16.png">' . PHP_EOL;
$html .= '<link rel="manifest" href="' . $baseUrl . 'manifest.json">' . PHP_EOL;
$html .= '<meta name="msapplication-TileColor" content="#ffffff">' . PHP_EOL;
$html .= '<meta name="msapplication-TileImage" content="' . $baseUrl . 'ms-icon-144x144.png">' . PHP_EOL;
$html .= '<meta name="theme-color" content="#ffffff">' . PHP_EOL;

return $html;
}
}

0 comments on commit 2492276

Please sign in to comment.