Browser Detection 2.4.1

XF 2.0 / 2.1 / 2.2 / 2.3 Browser Detection 2.4.1

  • Auteur de la discussion Auteur de la discussion laurent68
  • Date de début Date de début

Add-on xenforo 2

Ressources et modules complémentaires pour XenForo 2

Styles xenforo 2

Styles / Thèmes et apparence pour xenforo 2

Templates xenforo 2

Codes pour modifier les templates sur xenforo 2

Section Premium

Add-on et Styles pour membre Premium
  • ⚠️ Section Premium. Réserver aux Membres Premium ⚠️
Browser Detection 2.4.1

XF 2.0 / 2.1 / 2.2 / 2.3 Browser Detection 2.4.1

  • Auteur de la discussion Auteur de la discussion laurent68
  • Date de début Date de début
Catégorie Catégorie Add-Ons
Titre du sujet Titre du sujet Browser Detection 2.4.1
Auteur de la discussion Auteur de la discussion laurent68
Date de début Date de début
Réponses Réponses 20
Affichages Affichages 1 352
Réaction Réaction 5
Dernier message par Dernier message par adrin

laurent68

Fondateur

Staff
fondateur
Réputation: 100%
Discussions
5 120
Messages
13 425
Solutions
85
J'aime
8 171
Points
198
A light-weight shim around Mobile_detect for XenForo 2

Usage (in templates) :

The add-on injects the global variable $mobileDetect, check that the variable is set before calling any methods to prevent errors during upgrades or if the add-on is disabled.

HTML:
<xf:if is="$mobileDetect && $mobileDetect.isMobile()">
    Is Mobile
<xf:else />
    Not Mobile
</xf:if>

HTML:
<xf:if is="$mobileDetect && $mobileDetect.is('Firefox')">
  Is Firefox
<xf:else />
  Not Firefox
</xf:if>

HTML:
<xf:if is="$mobileDetect && $mobileDetect.is('Chrome')">
  Is Chrome
<xf:else />
  Not Chrome
</xf:if>

Usage (in php) :

PHP:
$mobileDetect = \SV\BrowserDetection\Listener::getMobileDetection();
$isMobile = $mobileDetect && $mobileDetect->isMobile() ? "_m1" : "_m0";

XF2.1 Page caching

The integration mobile detection with XF2.1+ full-page caching, add to the config.php this ;

PHP:
$config['pageCache']['onSetup'] = function (\XF\PageCache $pageCache) {
    $pageCache->setCacheIdGenerator(function(\XF\Http\Request $request) {
        return \SV\BrowserDetection\CacheHelper::getPageCacheId($request);
    });
};

Contributing features or bug fixes
Please create a Github Pull request via the "More information." link.

Contributions

If you appreciate this add-on, please consider a contribution via PayPal. Details will be provide via private conversation.
Please contact me if you wish for different licencing arrangements.

Licence

See MobileDetectLicense.md for Mobile-Detect's licence (MIT licensed)

Télécharger V2.0.1 :

Version 2.0.2 php 7.4 compatibility update : php 7.4 compatibility fix in mobile detection code

Télécharger V2.0.2 :

Version 2.1.0 - Feature update

Require php 7.0+
Require XenForo 2.1+
Inject is-mobile or is-tablet into PAGE_CONTAINER html class attribute based on detected user-agent

Télécharger V2.1.0 :

Version 2.1.1 - Maintenance update : Update MobileDetect library to v2.8.37

Télécharger V2.1.1 :

Version 2.1.3 Compatibility update : 3rd party add-on compatibility fix, rework how html element css injection works

Télécharger V2.1.3 :

Version 2.2.0 Feature/Maintenance :

Implement caching wrapper around Mobile_detect::match calls.
Forward unknown function calls to the wrapped Mobile_detect instance

Télécharger V2.2.0 :

Version 2.3.0 - Feature update :

This add-on is now available on atelieraphelion.com
- Require XenForo 2.2+
- Require php 7.2+
- Update MobileDetect library to 3.74.0 (Patched to support php 7.2, instead of php 7.4+)

Télécharger V2.3.0 :

Version 2.3.1 : Maintenance update & XF2.3 support
  • XF2.3 support
  • php 8.4 compatibility
  • Update MobileDetect library to 3.74.3

Télécharger V2.3.1 :

Version 2.4.0 - Feature update :
  • Restore XF2.1 support
  • Update Mobile Detect from v3.74.3 => v4.8.06.
    Note; this is a fork which retains php 7.2 compatibility
Télécharger V2.4.0 :

Version 2.4.1 :
- php 8.6 compatibility update
- Use
PHP:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.isMatch('Firefox')">
Instead of:
PHP:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.is('Firefox')">

Télécharger V2.4.1 :
 
Dernière édition par un modérateur:
Contenu similaire Les plus vues Voir plus
Retour
Haut Bas