{"id":19115,"date":"2012-07-21T12:23:56","date_gmt":"2012-07-21T12:23:56","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/detector\/"},"modified":"2012-09-10T16:46:52","modified_gmt":"2012-09-10T16:46:52","slug":"detector","status":"publish","type":"plugin","link":"https:\/\/twd.wordpress.org\/plugins\/detector\/","author":9030524,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.9.5","stable_tag":"0.9.5","tested":"3.0.5","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Detector","header_author":"Steve Barnett","header_description":"","assets_banners_color":"","last_updated":"2012-09-10 16:46:52","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/naga.co.za","rating":0,"author_block_rating":0,"active_installs":10,"downloads":2023,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.8.2","0.8.5","0.9.5"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[2568,1123,18637],"plugin_category":[],"plugin_contributors":[91015],"plugin_business_model":[],"class_list":["post-19115","plugin","type-plugin","status-publish","hentry","plugin_tags-detector","plugin_tags-device","plugin_tags-modernizr","plugin_contributors-stevebarnett-1","plugin_committers-stevebarnett-1"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/detector.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p><a href=\"http:\/\/detector.dmolsen.com\/\">Detector<\/a> is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices &amp; browsers on its own without the need to pull from a central database of browser information.<\/p>\n\n<p>Also available on GitHub: <a href=\"https:\/\/github.com\/SteveBarnett\/Detector\">https:\/\/github.com\/SteveBarnett\/Detector<\/a>.<\/p>\n\n<p>Full documentation is available at <a href=\"https:\/\/github.com\/dmolsen\/Detector\/\">github \/ dmolsen \/ Detector<\/a>.<\/p>\n\n<h3>To Do<\/h3>\n\n<ul>\n<li>Add some useful responsive image handling, in the style of <a href=\"https:\/\/github.com\/scottjehl\/picturefill\/\">picturefill.js<\/a>. Based on families at first?<\/li>\n<li>Add functions for conditional loading of content via JS, depending on screen size.<\/li>\n<li>wp_enqueue_script for Modernizr<\/li>\n<li>Check Modernizr version, custom<\/li>\n<li>Add option to add own <a href=\"https:\/\/github.com\/dmolsen\/Detector\/wiki\/Detector-Test-Tutorial\">feature tests<\/a> from admin area?<\/li>\n<li>Add option to add own <a href=\"https:\/\/github.com\/dmolsen\/Detector\/wiki\/Detector-Family-Tutorial\">families<\/a> from admin area?<\/li>\n<li>Add shortcodes?<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Go to Plugins &gt; Add New, Upload and choose detector.zip.<\/li>\n<li>Activate the plugin.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>How do I use Detector?<\/dt>\n<dd><p>In order to access the features you need to use the <code>$ua<\/code> object that is automatically created with the inclusion of Detector in your application. Use the <code>$ua<\/code> object in a similar way that you would have used the <code>Modernizr<\/code> object on the client-side:<\/p>\n\n<pre><code>global $ua;\n\n\/\/ your script\n\nif ($ua-&gt;svg) {\n    ...\n} elseif ($ua-&gt;canvas) {\n    ...\n}\n<\/code><\/pre>\n\n<p>See the <a href=\"http:\/\/detector.dmolsen.com\/demo\/modernizr-listing\/\">full list of browser features<\/a> that are tested by Modernizr and available with Detector. All of the features tested with <a href=\"https:\/\/github.com\/dmolsen\/ua-parser-php\">ua-parser-php<\/a> are also available from the <code>$ua<\/code> variable (e.g. <code>$ua-&gt;isMobile<\/code> or <code>$ua-&gt;browserFull<\/code>)<\/p>\n\n<p>Some features, (in particular <code>video<\/code>, <code>audio<\/code>, <code>input<\/code>, and <code>inputtypes<\/code>) have sub-features, so these are available as nested PHP objects:<\/p>\n\n<pre><code>if ($ua-&gt;inputtypes-&gt;search) {\n    print \"&lt;input type='search' ...\";\n} else {\n    print \"&lt;input type='text' ...\";\n}\n<\/code><\/pre>\n\n<p>All features are returned as integer <code>1<\/code> or <code>0<\/code> for <code>true<\/code> or <code>false<\/code>, so they can be used in logical evaluations in PHP. Sub-features can return <code>1<\/code>, <code>0<\/code>, or a real value (e.g. screen width).<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>0.9.5<\/h4>\n\n<p>Updated to match dmoslen's current Detector<\/p>\n\n<h4>0.8.5<\/h4>\n\n<p>Updated to match dmoslen's current Detector<\/p>\n\n<h4>0.8.2<\/h4>\n\n<p>Updated to match dmoslen's current Detector<\/p>\n\n<h4>0.8.1<\/h4>\n\n<ul>\n<li>Initial release. <a href=\"https:\/\/github.com\/tobie\/ua-parser\/commit\/303c8f905aa34110467cdfe730cf066ae6f6e18e#regexes.yaml\">regexes.yaml from 2012\/07\/12: 303c8f9<\/a><\/li>\n<\/ul>","raw_excerpt":"Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices &amp; browsers on its own without &hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/19115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=19115"}],"author":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/stevebarnett-1"}],"wp:attachment":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=19115"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=19115"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=19115"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=19115"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=19115"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=19115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}