Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivantcholakov/codeigniter-user-agent-helper
User Agent Helper Functions
https://github.com/ivantcholakov/codeigniter-user-agent-helper
codeigniter php
Last synced: 2 months ago
JSON representation
User Agent Helper Functions
- Host: GitHub
- URL: https://github.com/ivantcholakov/codeigniter-user-agent-helper
- Owner: ivantcholakov
- License: mit
- Created: 2013-10-24T16:46:33.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-24T21:01:25.000Z (over 11 years ago)
- Last Synced: 2024-10-16T23:06:31.110Z (4 months ago)
- Topics: codeigniter, php
- Language: PHP
- Size: 121 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
User Agent Helper Functions
===========================This set of helper functions is aimed for convenience in use the CodeIgniter's
User_agent library. Tested on CodeIgniter 2.1.4 and CodeIgniter 3.0-dev (October, 2013).Installation
------------Place the file user_agent_helper.php within your application/helpers folder.
A Quick Test
------------```php
$this->load->helper('user_agent');
var_dump(user_agent());
```A Usage Example for Making an Adaptive HTML Boilerplate
--------------------------------------------------------```php
if (!function_exists('template_enable_oldie')) {/**
* This function decides whether additional assets within a html template
* to be loaded for supporting older versions of Internet Explorer.
* Create within your system the following configuration options:
* $config['ie_min_supported_version'] = 6; // 6, 7, 8, 9, 10, ...
* $config['load_assets_by_ua_detection'] = true; // or false
* @autor Ivan Tcholakov, 2013.
* @license The MIT License, http://opensource.org/licenses/MIT
* @return boolean
*/
function template_enable_oldie() {$ie_min_supported = config_item('ie_min_supported_version');
if ($ie_min_supported < 9) {
if (config_item('load_assets_by_ua_detection')) {
ci()->load->helper('user_agent');
$browser = user_agent_ie();
if ($browser['is_ie']) {
if ($browser['ie_version'] < 9 &&
$browser['ie_version'] >= $ie_min_supported) {return true;
}return false;
}return false;
}return true;
}return false;
}}
```Author: Ivan Tcholakov , 2012-2013.
License: The MIT License (MIT), http://opensource.org/licenses/MIT