....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 41.207.40.59  /  Your IP : 216.73.216.58
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux srv-prod 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/formation/lib/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/formation/lib/tests/useragent_test.php
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * User agent test suite.
 *
 * @package    core
 * @copyright  2013 Sam Hemelryk
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @covers \core_useragent
 */
final class useragent_test extends advanced_testcase {

    /**
     * Restores the user agent to the default one.
     */
    public function tearDown(): void {
        core_useragent::instance(true);
        parent::tearDown();
    }

    /**
     * Data provider for known user agents.
     *
     * @return array
     */
    public static function user_agents_providers(): array {
        // Note: When adding new entries to this list, please ensure that any new browser versions are added to the corresponding list.
        // This ensures that regression tests are applied to all known user agents.
        return array(
            'Microsoft Edge for Windows 10 Desktop' => array(
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136',
                array(
                    'is_edge'                       => true,
                    'check_edge_version'            => array(
                        '12'                        => true,
                    ),

                    // Edge pretends to be WebKit.
                    'is_webkit'                     => true,

                    // Edge pretends to be Chrome.
                    // Note: Because Edge pretends to be Chrome, it will not be picked up as a Safari browser.
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'versionclasses'                => array(
                        'edge',
                    ),
                ),
            ),
            'Microsoft Edge for Windows 10 Mobile' => array(
                'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10136',
                array(
                    'is_edge'                       => true,
                    'check_edge_version'              => array(
                        '12'                        => true,
                    ),

                    // Edge pretends to be WebKit.
                    'is_webkit'                     => true,

                    // Mobile Edge pretends to be Android.
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    // Edge pretends to be Chrome.
                    // Note: Because Edge pretends to be Chrome, it will not be picked up as a Safari browser.
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'versionclasses'                => array(
                        'edge'
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Windows XP; Firefox 1.0.6.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6',
                array(
                    'is_firefox'                    => true,

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko17',
                    ),
                ),
            ),

            // Windows XP; Firefox 1.0.6.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8) Gecko/20051107 Firefox/1.5',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Windows XP; Firefox 1.5.0.1.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Windows XP; Firefox 2.0.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Ubuntu Linux amd64; Firefox 2.0.
            array(
                'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // SUSE; Firefox 3.0.6.
            array(
                'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.6) Gecko/2009012700 SUSE/3.0.6-1.4 Firefox/3.0.6',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko19',
                    ),
                ),
            ),

            // Linux i686; Firefox 3.6.
            array(
                'Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/3.6',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko20',
                    ),
                ),
            ),

            // Windows; Firefox 11.0.
            array(
                'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Windows; Firefox 15.0a2.
            array(
                'Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Firefox 18; Mac OS X 10.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:18.0) Gecko/18.0 Firefox/18.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                        '18'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                        '18.0'                      => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Firefox 33; Mac OS X 10.10.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                        '18'                        => true,
                        '19'                        => true,
                        '33'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                        '18.0'                      => true,
                        '19.0'                      => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // SeaMonkey 2.0; Windows.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20081208 SeaMonkey/2.0',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051106'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko19',
                    ),
                ),
            ),

            // SeaMonkey 2.1; Linux.
            array(
                'Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20110609 Firefox/4.0.1 SeaMonkey/2.1',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko20',
                    ),
                ),
            ),

            // SeaMonkey 2.3; FreeBSD.
            array(
                'Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0) Gecko/20110818 Firefox/6.0 SeaMonkey/2.3',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Mac OS X; MS Word 14.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X) Word/14.38.0',
                array(
                    'versionclasses'                => array(
                    ),

                    'is_msword'                     => true,
                ),
            ),

            // Safari 312; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // Safari 412; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // Safari 2.0; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // iOS Safari 528; iPhone.
            array(
                'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; cs-cz) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios'
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),

            // Safari; iPhone 6 Plus; iOS 8.1; Build 12B411.
            array(
                'Mozilla/5.0 (iPhone; CPU iPhone OS 10_10 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                        '590'                       => true,
                        '600'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),

            // iOS Safari 533; iPad.
            array(
                'Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'tablet',
               ),
            ),

            // Android WebKit 525; G1 Phone.
            'Android WebKit 525; G1 Phone' => array(
                'Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2 – G1 Phone',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'android',
                    ),

                    'devicetype'                    => 'mobile',

                    'supports_svg'                  => false,
               ),
            ),

            // Android WebKit 530; Nexus.
            'Android WebKit 530; Nexus' => array(
                'Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 –Nexus',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'android',
                    ),

                    'devicetype'                    => 'mobile',

                    'supports_svg'                  => false,
               ),
            ),

            // Android WebKit 537; Samsung GT-9505.
            array(
                'Mozilla/5.0 (Linux; Android 4.3; it-it; SAMSUNG GT-I9505/I9505XXUEMJ7 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                    ),

                    'versionclasses'                => array(
                        'chrome',
                        'android',
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Android WebKit 537; Nexus 5.
            array(
                'Mozilla/5.0 (Linux; Android 5.0; Nexus 5 Build/LPX13D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                    ),

                    'versionclasses'                => array(
                        'chrome',
                        'android',
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Chrome 8; Mac OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10',
                array(
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'chrome',
                    ),
                ),
            ),

            // Chrome 39; Mac OS X.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
                array(
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'chrome',
                    ),
                ),
            ),

            // Opera 12.15 (Build 1748); Mac OS X.
            array(
                'Opera/9.80 (Macintosh; Intel Mac OS X 10.10.0; Edition MAS) Presto/2.12.388 Version/12.15',
                array(
                    'is_opera'                      => true,
                    'check_opera_version'           => array(
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10.0'                      => true,
                        '12.15'                     => true,
                    ),

                    'versionclasses'                => array(
                        'opera',
                    ),
               ),
            ),

            // Google web crawlers.
            array(
                'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Googlebot/2.1 (+http://www.googlebot.com/bot.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Googlebot-Image/1.0',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Yahoo crawlers.
            // See https://help.yahoo.com/kb/slurp-crawling-page-sln22600.html.
            array(
                'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Bing / MSN / AdIdx crawlers.
            // See http://www.bing.com/webmaster/help/which-crawlers-does-bing-use-8c184ec0.
            array(
                'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (compatible; bingbot/2.0 +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'is_webkit'                     => true,
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),
            array(
                'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'is_ie'                         => true,
                    'check_ie_version'              => array(
                        '0'                         => true,
                        '5.0'                       => true,
                        '5.5'                       => true,
                        '6.0'                       => true,
                        '7.0'                       => true,
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10'                        => true,
                        '11'                        => true,
                    ),
                    'versionclasses'                => array(
                        'ie',
                        'ie11',
                    ),
                    'devicetype'                    => 'mobile',
               ),
            ),

            array(
                'msnbot/2.0b (+http://search.msn.com/msnbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'msnbot/2.1',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b',
                array(
                    'is_web_crawler'                => true,
                    'is_webkit'                     => true,
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                        '500'                       => true,
                    ),

                    'versionclasses'                => array(
                        'safari',
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko BingPreview/1.0b',
                array(
                    'is_web_crawler'                => true,
                    'is_ie'                         => true,
                    'check_ie_version'              => array(
                        '0'                         => true,
                        '5.0'                       => true,
                        '5.5'                       => true,
                        '6.0'                       => true,
                        '7.0'                       => true,
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10'                        => true,
                        '11'                        => true,
                    ),
                    'versionclasses'                => array(
                        'ie',
                        'ie11',
                    ),
                    'devicetype'                    => 'mobile',
               ),
            ),

            // Yandex.
            // See http://help.yandex.com/search/robots/agent.xml.
            array(
                'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (compatible; YandexImages/3.0; +http://yandex.com/bots)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // AltaVista.
            array(
                'AltaVista V2.0B crawler@evreka.com',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // ZoomSpider.
            array(
                'ZoomSpider - wrensoft.com [ZSEBOT]',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Baidu.
            array(
                'Baiduspider+(+http://www.baidu.com/search/spider_jp.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Baiduspider+(+http://www.baidu.com/search/spider.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Ask.com.
            array(
                'User-Agent: Mozilla/2.0 (compatible; Ask Jeeves/Teoma)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // MoodleBot.
            array(
                'User-Agent: MoodleBot/3.8 (+https://moodle.org)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Macos Desktop app.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) moodlemobile/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Linux Desktop app.
            array(
                'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) moodledesktop/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Windows Desktop app.
            array(
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) moodledesktop/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Android app.
            array(
                'Mozilla/5.0 (Linux; Android 7.1.1; Moto G Play Build/NPIS26.48-43-2; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_webkit_android'            => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'devicetype'                   => 'mobile',
                    'check_webkit_android_version' => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),
                    'versionclasses'               => array(
                        'android',
                        'chrome'
                    ),
               ),
            ),

            // Android app, user agent lower case.
            array(
                'Mozilla/5.0 (Linux; Android 7.1.1; Moto G Play Build/NPIS26.48-43-2; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 moodlemobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_webkit_android'            => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'devicetype'                   => 'mobile',
                    'check_webkit_android_version' => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),
                    'versionclasses'               => array(
                        'android',
                        'chrome'
                    ),
               ),
            ),

            // iOS (iPhone) app.
            array(
                'Mozilla/5.0 (iPhone; CPU OS 13_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_ios'                       => true,
                    'is_webkit'                    => true,
                    'devicetype'                   => 'mobile',
                    'versionclasses'               => array(
                    ),
               ),
            ),

            // iOS (iPad) app.
            array(
                'Mozilla/5.0 (iPad; CPU OS 12_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D39 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_ios'                       => true,
                    'is_webkit'                    => true,
                    'devicetype'                   => 'tablet',
                    'versionclasses'               => array(
                    ),
               ),
            ),
        );
    }

    /**
     * Test instance generation.
     */
    public function test_instance(): void {
        $this->assertInstanceOf('core_useragent', core_useragent::instance());
        $this->assertInstanceOf('core_useragent', core_useragent::instance(true));
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_edge($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // Edge Tests.
        if (isset($tests['is_edge']) && $tests['is_edge']) {
            $this->assertTrue(core_useragent::is_edge());
        } else {
            $this->assertFalse(core_useragent::is_edge());
        }

        $versions = array(
            // New versions of should be added here.
            '12'   => false,
        );

        if (isset($tests['check_edge_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_edge_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_edge_version($version),
                "Version incorrectly determined for Edge version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ie($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // IE Tests.
        if (isset($tests['is_ie']) && $tests['is_ie']) {
            $this->assertTrue(core_useragent::is_ie());
        } else {
            $this->assertFalse(core_useragent::is_ie());
        }

        $versions = array(
            // New versions of should be added here.
            '0'    => false,
            '5.0'  => false,
            '5.5'  => false,
            '6.0'  => false,
            '7.0'  => false,
            '8.0'  => false,
            '9.0'  => false,
            '10'   => false,
            '11'   => false,
            '12'   => false,
            '13'   => false,
            '14'   => false,
        );

        if (isset($tests['check_ie_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_ie_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_ie_version($version),
                "Version incorrectly determined for IE version '{$version}'");
        }

        // IE Compatibility mode.
        if (isset($tests['iecompatibility']) && $tests['iecompatibility']) {
            $this->assertTrue(core_useragent::check_ie_compatibility_view(), "IE Compability false negative");
        } else {
            $this->assertFalse(core_useragent::check_ie_compatibility_view(), "IE Compability false positive");
        }

    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_msword($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // MSWord Tests.
        if (isset($tests['is_msword']) && $tests['is_msword']) {
            $this->assertTrue(core_useragent::is_msword());
        } else {
            $this->assertFalse(core_useragent::is_msword());
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_supports($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // Supports SVG.
        if (!isset($tests['supports_svg']) || $tests['supports_svg']) {
            $this->assertTrue(core_useragent::supports_svg(),
                "SVG Support was not reported (and should have been)");
        } else {
            $this->assertFalse(core_useragent::supports_svg(),
                "SVG Support was reported (and should not have been)");
        }

        // Supports JSON ContentType.
        if (!isset($tests['supports_json_contenttype']) || $tests['supports_json_contenttype']) {
            $this->assertTrue(core_useragent::supports_json_contenttype(),
                "JSON ContentType Support was not reported (and should have been)");
        } else {
            $this->assertFalse(core_useragent::supports_json_contenttype(),
                "JSON ContentType Support was reported (and should not have been)");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_webkit($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_webkit']) && $tests['is_webkit']) {
            $this->assertTrue(core_useragent::is_webkit(),
                "Browser was not identified as a webkit browser");
            $this->assertTrue(core_useragent::check_webkit_version());
        } else {
            $this->assertFalse(core_useragent::is_webkit(),
                "Browser was incorrectly identified as a webkit browser");
            $this->assertFalse(core_useragent::check_webkit_version());
        }

        $versions = array(
            // New versions should be added here.
        );

        if (isset($tests['check_webkit_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_webkit_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_webkit_version($version),
                "Version incorrectly determined for Webkit version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_webkit_android($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_webkit_android']) && $tests['is_webkit_android']) {
            $this->assertTrue(core_useragent::is_webkit_android(),
                "Browser was not identified as an Android webkit browser");
            $this->assertTrue(core_useragent::check_webkit_android_version());
        } else {
            $this->assertFalse(core_useragent::is_webkit_android(),
                "Browser was incorrectly identified as an Android webkit browser");
            $this->assertFalse(core_useragent::check_webkit_android_version());
        }

        $versions = array(
            // New versions should be added here.
            '525'       => false,
            '527'       => false,
            '590'       => false,
        );

        if (isset($tests['check_webkit_android_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_webkit_android_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_webkit_android_version($version),
                "Version incorrectly determined for Android webkit version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_chrome($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_chrome']) && $tests['is_chrome']) {
            $this->assertTrue(core_useragent::is_chrome(),
                "Browser was not identified as a chrome browser");
            $this->assertTrue(core_useragent::check_chrome_version());
        } else {
            $this->assertFalse(core_useragent::is_chrome(),
                "Browser was incorrectly identified as a chrome browser");
            $this->assertFalse(core_useragent::check_chrome_version());
        }

        $versions = array(
            // New versions should be added here.
            '7'         => false,
            '8'         => false,
            '10'        => false,
            '39'        => false,
        );

        if (isset($tests['check_chrome_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_chrome_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_chrome_version($version),
                "Version incorrectly determined for Chrome version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_safari($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_safari']) && $tests['is_safari']) {
            $this->assertTrue(core_useragent::is_safari(),
                "Browser was not identified as a safari browser");
            $this->assertTrue(core_useragent::check_safari_version());
        } else {
            $this->assertFalse(core_useragent::is_safari(),
                "Browser was incorrectly identified as a safari browser");
            $this->assertFalse(core_useragent::check_safari_version());
        }

        // Check Safari (generic).
        $versions = array(
            // New versions should be added here.
            '1'         => false,
            '312'       => false,
            '500'       => false,
        );

        if (isset($tests['check_safari_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_safari_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_safari_version($version),
                "Version incorrectly determined for Safari (generic) version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ios_safari($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_safari_ios']) && $tests['is_safari_ios']) {
            $this->assertTrue(core_useragent::is_safari_ios(),
                "Browser was not identified as an iOS safari browser");
            $this->assertTrue(core_useragent::check_safari_ios_version());
        } else {
            $this->assertFalse(core_useragent::is_safari_ios(),
                "Browser was incorrectly identified as an iOS safari browser");
            $this->assertFalse(core_useragent::check_safari_ios_version());
        }

        // Check iOS Safari.
        $versions = array(
            // New versions should be added here.
            '527'       => false,
            '590'       => false,
            '600'       => false,
        );

        if (isset($tests['check_safari_ios_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_safari_ios_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_safari_ios_version($version),
                "Version incorrectly determined for iOS Safari version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ios($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_ios']) && $tests['is_ios']) {
            $this->assertTrue(core_useragent::is_ios(),
                "Browser was not identified as an iOS device browser");
            // The iOS app is not Safari based.
            if (!isset($tests['is_moodle_app']) || !$tests['is_moodle_app']) {
                $this->assertTrue(core_useragent::check_safari_ios_version());
            }
        } else {
            $this->assertFalse(core_useragent::is_ios(),
                "Browser was incorrectly identified as an iOS device browser");
            $this->assertFalse(core_useragent::check_safari_ios_version());
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_gecko($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_gecko']) && $tests['is_gecko']) {
            $this->assertTrue(core_useragent::is_gecko(),
                "Browser was not identified as a gecko browser");
            $this->assertTrue(core_useragent::check_gecko_version());
        } else {
            $this->assertFalse(core_useragent::is_gecko(),
                "Browser was incorrectly identified as a gecko browser");
            $this->assertFalse(core_useragent::check_gecko_version());
        }

        $versions = array(
            // New versions should be added here.
            '1'             => false,
            '2'             => false,
            '3.6'           => false,
            '4.0'           => false,
            '20030516'      => false,
            '20051116'      => false,
            '2006010100'    => false,
            '20100101'      => false,
            '15.0'          => false,
            '18.0'          => false,
            '19.0'          => false,
        );

        if (isset($tests['check_gecko_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_gecko_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_gecko_version($version),
                "Version incorrectly determined for Gecko version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_firefox($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_firefox']) && $tests['is_firefox']) {
            $this->assertTrue(core_useragent::is_firefox(),
                "Browser was not identified as a firefox browser");
            $this->assertTrue(core_useragent::check_firefox_version());
        } else {
            $this->assertFalse(core_useragent::is_firefox(),
                "Browser was incorrectly identified as a firefox browser");
            $this->assertFalse(core_useragent::check_firefox_version());
        }

        $versions = array(
            // New versions should be added here.
            '1.5'       => false,
            '3.0'       => false,
            '4'         => false,
            '10'        => false,
            '15'        => false,
            '18'        => false,
            '19'        => false,
            '33'        => false,
        );

        if (isset($tests['check_firefox_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_firefox_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_firefox_version($version),
                "Version incorrectly determined for Firefox version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_opera($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_opera']) && $tests['is_opera']) {
            $this->assertTrue(core_useragent::is_opera(),
                "Browser was not identified as a opera browser");
            $this->assertTrue(core_useragent::check_opera_version());
        } else {
            $this->assertFalse(core_useragent::is_opera(),
                "Browser was incorrectly identified as a opera browser");
            $this->assertFalse(core_useragent::check_opera_version());
        }

        $versions = array(
            // New versions should be added here.
            '8.0'       => false,
            '9.0'       => false,
            '10.0'      => false,
            '12.15'     => false,
        );

        if (isset($tests['check_opera_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_opera_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_opera_version($version),
                "Version incorrectly determined for Opera version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_get_device_type($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expected = 'default';
        if (isset($tests['devicetype'])) {
            $expected = $tests['devicetype'];
        }

        $this->assertEquals($expected, core_useragent::get_device_type(),
            "Device Type was not correctly identified");
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_get_browser_version_classes($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $actual = core_useragent::get_browser_version_classes();
        foreach ($tests['versionclasses'] as $expectedclass) {
            $this->assertContains($expectedclass, $actual);
        }
        $this->assertCount(count($tests['versionclasses']), $actual);
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_web_crawler($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expectation = isset($tests['is_web_crawler']) ? $tests['is_web_crawler'] : false;
        $this->assertSame($expectation, core_useragent::is_web_crawler());
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_moodle_app($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expectation = isset($tests['is_moodle_app']) ? $tests['is_moodle_app'] : false;
        $this->assertSame($expectation, core_useragent::is_moodle_app());
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit