[WordPress] 外掛分享: PHP Browser Detection

前言介紹

  • 這款 WordPress 外掛「PHP Browser Detection」是 2010-01-28 上架。
  • 目前有 800 個安裝啟用數。
  • 上一次更新是 2015-09-08,距離現在已有 3525 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 有 16 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

mindshare | martythornley |

外掛標籤

php | iphone | browser | browser detection | internet explorer |

內容簡介

版本3新增對於is_tablet()、is_desktop()和is_browser()函數的支援,同時進行了許多錯誤修正及程式碼優化。從版本3.1.2開始,browscap.ini的自動更新已被停用,直到我們解決了記憶體使用問題為止。

PHP Browser Detection是一個WordPress外掛,用於偵測使用者的瀏覽器。它可以用於為Internet Explorer發送條件性CSS檔案、在頁面上的任何位置顯示不同的內容或自訂訊息,以及為iPhone切換Flash為圖片。

樣板標籤:

測試特定的瀏覽器:

$version是可選的。包括主要版本號碼,單個整數-3、4、5等等... 或留空以測試任何版本。

檢查手機、平板電腦、iPhone、iPad、iPod等等...

檢查大於或小於特定版本...

小於或等於Firefox 19:
< ?php if(is_firefox() && get_browser_version()

小於或等於IE 10:
< ?php if(is_ie() && get_browser_version()

大於或等於Safari 4:
= 4) { /* 你的程式碼 */ }; ?>

這只是一些例子,但這個語法將適用於任何瀏覽器或版本。

檢查特定版本號碼...

瀏覽器是否為IE6?

瀏覽器是否為IE10?

或者你可以獲取所有信息並對其進行操作:

僅獲取名稱...

獲取完整版本號碼 - 3.2、5.0等等...

或者在數組中獲取全部資訊...

短代碼:

測試特定瀏覽器:

[is_browser name="chrome" version="45"]

你使用的是Chrome 45或更高版本。


[/is_browser]

輸出所有瀏覽器資訊:

[browser_info]

原文外掛簡介

Version 3 adds support for is_tablet(), is_desktop(), and is_browser() as well as numerous bug fixes and code improvements. As of version 3.1.2 automatic updates of browscap.ini are disabeld until we can deal with memory usage issues.
PHP Browser Detection is a WordPress plugin used to detect a user’s browser. It can be used to send conditional CSS files for Internet Explorer, display different content or custom messages anywhere on the page, or to swap out Flash for an image for iPhones.
Template Tags:
Test for specific browsers:
$version is optional. Include a major version number, a single integer – 3,4,5, etc… Or leave it empty to test for any version.

Check for mobile, tablet, iPhone, iPad, iPod, etc…

Check for greater than / less than a specific version…
Less than or equal to Firefox 19:

these are just a few examples, but this syntax will work for any browser or version.
Check specific versions…
Is the browser IE6?

Is the browser IE10?

Or you can get all the info and do what you want with it:
Get just the name…

Get the full version number – 3.2, 5.0, etc…

Or get it all in array…

Shortcodes:
Test for specific browsers:
[is_browser name="chrome" version="45"]

You are using Chrome 45 or above.

[/is_browser]

Output all browser info:
[browser_info]

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「PHP Browser Detection」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


2.1 | 2.2 | 3.0 | 3.1 | 2.1.1 | 2.1.2 | 2.1.3 | 2.2.1 | 2.2.2 | 2.2.3 | 2.2.4 | 3.1.1 | 3.1.2 | 3.1.3 | 3.1.4 | 3.1.5 | 3.1.6 | 3.1.7 | 3.1.8 | trunk |

延伸相關外掛(你可能也想知道)

  • WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager 》插入標頭和頁腳 + 完整的 WordPress 代碼片段外掛, WPCode (前稱为 WPBeginner 的 "插入標頭和頁腳")是使用率超过 100 万个网站的 WordPress 代码片段外掛中...。
  • Code Snippets 》Code Snippets 是在您的網站上運行程式碼片段的簡單,清潔和簡單的方法。它消除了將自定義片段添加到您的佈景主題的 functions.php 檔案的需求。, 現在提供 C...。
  • PHP Compatibility Checker 》WP Engine PHP Compatibility Checker 外掛可以讓任何 WordPress 網站在任何網頁主機上檢查 PHP 版本相容性。, 此外掛會在 WordPress 檔案系統中 lint 主題和...。
  • PHP Code Widget 》普通的文字小工具允許您插入任意文字和/或 HTML 代碼。這個外掛程式也允許這樣做,但還會解析文本小工具中的任何 PHP 代碼並執行它。, 這可以讓您更輕鬆地遷...。
  • SyntaxHighlighter Evolved 》現在支援 WordPress 5.0 中的新區塊編輯器!, SyntaxHighlighter Evolved 讓您可以輕鬆地在網站上張貼帶有語法加亮功能的程式碼,而不會失去格式或做任何手動...。
  • PHP Everywhere 》注意:此外掛更新至 3.0.0 版本是一項重大變更,將移除 [php_everywhere] 短代碼和小工具。請透過外掛設定頁面中的升級嚮導,將原本的代碼轉換為 Gutenberg ...。
  • Error Log Monitor 》此外掛新增了一個儀表板小工具,顯示 PHP 錯誤日誌的最新訊息,也可以發送電子郵件通知有新記錄的錯誤。, 功能, , 自動偵測錯誤日誌的位置。, 如果未啟用,會...。
  • WP-ServerInfo 》狀態標誌, , 開發, https://github.com/lesterchan/wp-serverinfo, 翻譯, https://translate.wordpress.org/projects/wp-plugins/wp-serverinfo, 貢獻者, , ...。
  • WP-Memory-Usage 》從1.2.7版開始新增「多重記憶體測量」功能,可多次檢查記憶體使用情況。, 在儀表板和管理頁尾顯示 PHP 版本、記憶體限制和目前的記憶體使用量,現在您可以輕...。
  • Version Info | Show WP, PHP, MySQL & Web Server Versions in Admin Dashboard 》這個外掛會在管理員頁面的頁尾顯示當前的 WordPress 版本號碼以及以下環境資訊:, , 當前的 WordPress 版本資訊,若有更新,會同時顯示當前版本與最新版本, P...。
  • WP OPcache 》清空OPcache, , 在管理列中添加一個按鈕以清空OPcache, 僅清空WordPress絕對路徑中的文件, 可以單個或批次失效文件, 支援記憶體和檔案緩存, 支援多站網路, , ...。
  • Custom PHP Settings 》這個外掛可以用來自訂你 WordPress 安裝的 PHP 設定。這個外掛會修改 .htaccess 檔案或 .user.ini 檔案,以便直接從設定頁面更改目前的 PHP 設定。由於需要修...。
  • CSS & JavaScript Toolbox 》感謝您查看我們的程式碼片段外掛。我相信它將完全符合您的需求。, 適用於以下情況:, , 前端修改(無需修改主題文件), 添加功能(無需修改functions.php), ...。
  • ACF Theme Code for Advanced Custom Fields 》ACF Theme Code 外掛可以自動生成在主題中實現 Advanced Custom Fields 所需的程式碼。以下是該外掛的功能特色:, , - 縮短網站開發時間。, - 當您發布、編輯...。
  • Code Block Pro – Beautiful Syntax Highlighting 》展示你美麗的程式碼,不僅僅是顯示它!這個版塊外掛提供編輯程式碼塊的功能,直接運行你的程式碼,使用與受歡迎的 VS Code 編輯器相同的渲染引擎。此外掛提供...。

文章
Filter
Apply Filters
Mastodon