1 vài helper cơ bản khi sử dụng với CodeIgniter 3.
Có thể đưa vào nhiều bộ code khác, tuy nhiên có 1 số function require framework CodeIgniter, tuy nhiên không ảnh hưởng tới hiệu suất sử dụng
Dưới đây là danh sách các Helper được hỗ trợ trong bộ thư viện này
- Helper Function:
generateAlphaId
- Hàm giúp tạo 1 Id unique4ew68i32xc
dựa trên 1 int đầu vào như1234
- Helper Function:
arrayToObject
- Hàm giúp chuyển 1 array thành 1 object - Helper Function:
arrayToXml
- Hàm giúp chuyển array thành 1 chuỗi XML
- Helper Function:
assets_url
- Hàm lấy ra Assets Url, điều kiện tồn tại thư mụcassets
trong thư mụcpublic/
. Trong trường hợp trong fileconfig.php
tồn tại biếnassets_version
sẽ tự động thêm version vào đằng sau các file CSS, JS - Helper Function:
templates_url
- Hàm lấy ra Assets Url, điều kiện tồn tại thư mụctemplates
trong thư mụcpublic/
. Trong trường hợp trong fileconfig.php
tồn tại biếnassets_version
sẽ tự động thêm version vào đằng sau các file CSS, JS - Helper Function:
editor_url
- Hàm lấy ra Assets Url, điều kiện tồn tại thư mụcassets/editors/
trong thư mụcpublic/
. Trong trường hợp trong fileconfig.php
tồn tại biếnassets_version
sẽ tự động thêm version vào đằng sau các file CSS, JS - Helper Function:
favicon_url
- Hàm lấy ra Assets Url, điều kiện tồn tại thư mụcassets/favicon/
trong thư mụcpublic/
. Trong trường hợp trong fileconfig.php
tồn tại biếnassets_version
sẽ tự động thêm version vào đằng sau các file CSS, JS - Helper Function:
storage_url
- Need configstorage_url
item in config.php file. VD:$config['storage_url'] = 'https://storage.nguyenanhung.com/';
- Helper Function:
go_url
- Need configgo_url
item inconfig.php
file. VD:$config['go_url'] = 'https://go.nguyenanhung.com/';
- Helper Function:
assets_mobile
- Helper Function:
assets_themes
- Helper Function:
assets_themes_dashboard
- Helper Function:
assets_themes_comingsoon
- Helper Function:
assets_themes_error
- Helper Function:
isEmpty
- Kiểm tra 1 input đầu vào xem có phải là rỗng hay không
- Helper Function:
dd
- Helper Function:
ddd
- Helper Function:
formatSizeUnits
- Hàm format 1 int đầu vào thành 1 format để dễ đọc dung lượng file - Helper Function:
genarateFileIndex
- Tự động tạo nội dung fileindex.html
- Helper Function:
genarateFileHtaccess
- Tự động tạo nội dung file.htaccess
- Helper Function:
genarateFileReadme
- Tự động tạo nội dung fileREADME.md
- Helper Function:
makeNewFolder
- Hàm tạo 1 thư mục mới và genre sẵn trong đó 3 file:README.md
,index.html
,.htaccess
- Helper Function:
new_folder
- Chức năng tương tự với hàmmakeNewFolder
- Helper Function:
meta_dns_prefetch
- Helper Function:
meta_property
- Helper Function:
tachPage
- Helper Function:
stripHtmlTag
- Helper Function:
strip_only_tags
- Helper Function:
tracking_google_analytics
- Helper Function:
google_image_resize
- Helper Function:
google_image_proxy_dns_prefetch
- Helper Function:
wordpress_proxy
- Helper Function:
wordpress_proxy_dns_prefetch
- Helper Function:
getIPAddress
- Hàm lấy ra địa chỉ IP thực tế của người dùng - Helper Function:
validateIP
- Hàm validate 1 string có phải IP ko. TRUE nếu đó là IP - Helper Function:
validateIPV4
- Hàm validate 1 string có phải IP v4 ko. TRUE nếu đó là IP - Helper Function:
validateIPV6
- Hàm validate 1 string có phải IP v6 ko. TRUE nếu đó là IP - Helper Function:
getIpInformation
- Khởi tạo 1 request đếnIP-API
để lấy thông tin của địa chỉ IP
- Helper Function:
setupMetaDnsPrefetch
- Hàm hỗ trợ gen ra 1 đoạn HTML Dns Prefetch tương tự<link href='//data.nguyenanhung.com/' rel='dns-prefetch' />
Helper này sử dụng gói hidehalo/nanoid-php
để gen ra 1 mã random Id nhỏ, nhẹ và an toàn hơn nhiều so với UUID.
Hiện tại việc sử dụng nanoid đang là xu hướng so với uuid truyền thống
Để sử dụng được gói này, cần cài packages nguyenanhung/nanoid-helper
bằng lệnh composer require nguyenanhung/nanoid-helper
- Helper Function:
randomNanoId
- Helper Function:
view_paginations
- Helper Function:
view_more
- Helper Function:
select_page
- Helper Function:
get_paginations_title
- Helper Function:
get_paginations_number
- Helper Function:
convert_string_utf8_to_vietnamese
- Helper Function:
clean_allowfullscreen
- Helper Function:
clean_text
- Helper Function:
clean_title
- Helper Function:
clean_text_mobile
- Helper Function:
bodautru
- Helper Function:
bodaunhay
- Helper Function:
searchs_snippets
- Helper Function:
tags_snippets
- Helper Function:
tags_clean
- Helper Function:
short_url_with_tinyurl
- Hàm hỗ trợ shortUrl dựa trên API của TinyURL
- Helper Function:
share_url
- Helper Function:
encodeId_Url_byHungDEV
- Helper Function:
decodeId_Url_byHungDEV
- Helper Function:
convertToLatin
- Helper Function:
specialCharToNormalChar
- Helper Function:
alphabetOnly
- Helper Function:
boDauTiengViet
- Helper Function:
removeSpecialChar
- Helper Function:
getPermalinksSEO
- Helper Function:
generate_uuid_v4
- Hàm tạo ra 1 chuỗi UUID v4 ngẫu nhiên
- Helper Function:
parse_sitemap_index
STT | Name | Github | |
---|---|---|---|
1 | Hung Nguyen | dev@nguyenanhung.com | @nguyenanhung |