前言介紹
- 這款 WordPress 外掛「Page Guard」是 2017-03-20 上架。
- 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
- 上一次更新是 2022-08-22,距離現在已有 986 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 4.7 以上版本才可以安裝。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
fculross |
外掛標籤
url | post | query string | conditional title | conditional output |
內容簡介
Page Guard使用單個URL參數或POST變量作為提供令牌的手段,以保護放置此插件shortcode的任何頁面。當令牌缺失或不匹配預期值時,可以輸出替換內容 - 如果收到的令牌與預期值匹配,則可以向訪問者顯示受控內容。
對於此版本,附加的shortcode屬性“title”還允許條件性地更改頁面標題,但前提是在瀏覽器中啟用了JAVASCRIPT(如果JavaScript被關閉,則不起作用!)
要使用的shortcode是“pageguard” - 其屬性為:
tokenparam(必需) -> 包含令牌URL param的字符串值 - 例如“mytoken”
eq(可選) -> 包含tokenparam的預期值的字符串值 - 例如'x34ggj45b'
ne(可選) -> 對於“eq”,但在使用時,shortcode將在未匹配令牌時輸出內容
absent(可選) -> 當absent =“1”時,shortcode將在檢測到缺少令牌時輸出內容
title(可選) -> 包含父shortcode條件符合時應用的頁面標題的字符串
語法示例:
顯示匹配令牌的區塊 -
[pageguard param="token" eq="download"]
找到匹配令牌時要輸出的文本
[/pageguard]
顯示非匹配區塊+更改標題
[pageguard tokenparam="token" ne="download" title="Downloads - invalid token"]
當令牌不匹配時輸出錯誤文本
[/pageguard]
顯示找不到令牌的內容+更改標題
[pageguard tokenparam="token" absent="1" title="Downloads - missing token"]
當令牌缺失時輸出錯誤文本
[/pageguard]
使用方法
典型的使用情況可能是控制對下載頁面的訪問。假設您在網站上使用PayPal“立即購買”按鈕,該按鈕允許訪問者支付電子書或音頻錄音等項目。在您的PayPal帳戶中設置按鈕時,您指定返回頁面上的URL,訪問者在支付後返回該頁面。在此返回頁面上,您添加了訪問者可以使用的鏈接以下載其購買內容 - 但是,您不希望任何未付款的訪問者也有權訪問頁面上的下載鏈接!如果您還希望頁面標題反映任何錯誤條件,則可以使用“title”屬性來執行此操作(請注意,此功能取決於JavaScript在用戶的瀏覽器中啟用 - 它被禁用,“title”無效)。
在您設置了PayPal按鈕時,將參數添加到返回URL的末尾(使用任何名稱和值):
"http://your.wordpress.site/download/?dltoken=x34ggj45b"
接下來,將要處理的情況的pageguard shortcode添加到您的WordPress返回頁面中 -
[pageguard param="token" eq="x34ggj45b" title="Title for matched token"]
找到匹配令牌時要輸出的文字
[/pageguard]
[pageguard tokenparam="token" ne="x34ggj45b" title="Title for failed match"]
當令牌不匹配時輸出錯誤文本
[/pageguard]
[pageguard tokenparam="token" absent="1" title="Title for missing token"]
當令牌缺失時輸出錯誤文本
[/pageguard]
這將在Page Guard檢測到匹配令牌時正確顯示頁面的主要內容。如果令牌不正確或缺失,還可以提供額外的錯誤內容。
原文外掛簡介
Page Guard uses a single URL parameter or POST variable as a means of providing a token to guard access to any page on which this plugin’s shortcode is placed. Output of alternative content can be made to occur when the token is missing or fails to match what is expected – if the token received matches the expected one, the controlled content can be revealed to the visitor.
For this version, an additional shortcode attribute “title” also allows the page title to be changed conditionally PROVIDED JAVASCRIPT IS ENABLED IN THE BROWSER (it has no effect if JavaScript is turned off!)
The shortcode to use is ‘pageguard’ – its attributes are:
tokenparam (required) -> a string value containing the name of the token URL param - e.g. 'mytoken'
eq (optional) -> a string value containing the expected value of the tokenparam - e.g. 'x34ggj45b'
ne (optional) -> as for "eq" but when used, shortcode will output content on non matching token
absent (optional) -> when absent="1", shortcode will output content on detection of missing token
title (optional) -> a string containing a page title to apply when the parent shortcode's criteria are met
Syntax examples:
show block on matching token -
[pageguard param="token" eq="download"]
Text to be output on matching token found
[/pageguard]
show block on non match + change title
[pageguard tokenparam="token" ne="download" title="Downloads - invalid token"]
Error text for output when token fails to match
[/pageguard]
show this on no token found + change title
[pageguard tokenparam="token" absent="1" title="Downloads - missing token"]
Error text for output when token is missing
[/pageguard]
Usage
A typical use scenario might be to control access to a downloads page. Suppose you have a PayPal “Buy Now” button on your site which allows visitors to make a payment for say, an eBook or audio recording. When setting up the button in your PayPal account you specify a URL on your site to which the visitor is returned after they’ve made payment. On this return page you’ve added a link the visitor can use to download their purchase – however, you don’t want any non paying visitors to have access to the download link(s) on the page! If you also want the page title to reflect any error conditions, you an use the “title” attribute to do this (please be aware however that this functionality depends on JavaScript being enable in the user’s browser – it disabled, “title” has no effect.)
Add a parameter to the end of the return URL (using any name and value you want) when you set up your button in PayPal e.g.
"http://your.wordpress.site/download/?dltoken=x34ggj45b"
Next, add pageguard short codes for the cases you intend to handle to your return page in WordPress –
[pageguard param="token" eq="x34ggj45b" title="Title for matched token"]
Text to be output on matching token found
[/pageguard]
[pageguard tokenparam="token" ne="x34ggj45b" title="Title for failed match"]
Error text for output when token fails to match
[/pageguard]
[pageguard tokenparam="token" absent="1" title="Title for missing token"]
Error text for output when token is missing
[/pageguard]
This will correctly display the main content for the page when Page Guard detects a matching token. It also provides for the possibility of providing different error content for the page in the event of the token being incorrect or missing.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Page Guard」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
PS Auto Sitemap 》PS Auto Sitemap 是一個 WordPress 外掛,自動從您的 WordPress 網站生成網站地圖頁面。, 對於初學者來說,安裝非常容易;對於專家來說,定制也非常容易。您...。
Post Type Switcher 》這個外掛在文章編輯介面中新增了一個簡單的文章型別下拉選單,讓你可以重新指派任何文章至新的文章型別。你可以在編輯文章時更換文章的型別。, 支援的型別, ...。
Post Duplicator 》這個外掛是用來製作選定文章的完全一模一樣複製。它支援自訂文章類型、自訂分類和自訂欄位。, *注意: 評論不會被複製到新文章。, 這個外掛的目的是為了快速且...。
Optimize Database after Deleting Revisions 》這個外掛是一個「一鍵式」WordPress資料庫清理/優化器。, 主要功能, , 刪除文章、頁面和/或自訂文章類型的修訂版本(您可以選擇保留最近的「X」個修訂版本,...。
Advanced Excerpt 》這個外掛可以改進 WordPress 原有的摘錄文章功能。, , 保留摘錄中的 HTML 標記,並可自選需要保留的標記, 按字元數或字數截斷摘錄, 只計算「真正的」文字(HT...。
Add From Server 》這個外掛提供有限的支援。請不要期望有太多新功能或修正 bug。功能可能隨時被移除。, Add From Server 外掛旨在幫助緩解不好的網站主機所造成的困擾,讓您可...。
Page and Post Clone 》這個外掛可以透過一個按鈕來複製貼文或頁面,現在您不必從零開始進行新頁面或貼文的樣式設計。, 這個外掛的主要功能包括:, , 建立一個頁面複本,保留所有內...。
WP Page Widget 》這款外掛讓小工具的選擇變得更加容易。啟用此外掛後,我們可以選擇要顯示在特定頁面/文章/自訂文章類型中的小工具。, 請注意,使用此外掛時必須啟用側邊欄主題。。
WP Total Hacks 》WP Total Hacks 可以在您的 WordPress 網站上自訂超過 20 個設置。, 此外掛已在 GitHub 上發布。, 一些功能:, 您可以選擇啟用或停用所有項目。, 需要 PHP5!...。
Revision Control 》**本外掛不提供支援。仍可使用,但請勿期待得到支援要求的回應或對「這無法運作」進行回應。**, Revision Control 是 WordPress 的一款外掛,可以讓使用者更...。
Reveal IDs 》WordPress 2.5版本發佈後,所有管理頁面的ID都被刪除了。這應該是因為普通用戶不需要它們。但對於高級WordPress用戶和開發人員來說,這些ID對某些外掛或模板...。
Bulk Delete 》Bulk Delete 是一個 WordPress 外掛,可以根據不同的條件和過濾器批次刪除文章、頁面、附件、使用者和元資料。此外掛支援以下條件和過濾器:, , 刪除文章, , ...。
WP Admin UI Customize 》, 儀表板, 顯示選項標籤, 輸出 - 元網站, 管理工具列 (Toolbar), 側邊選單 (Side menu), 元箱的管理, 登入畫面, 其他功能, , 這些自訂化都是可以實現的。, , ...。
Themify Portfolio Post 》Themify Portfolio Posts 是一個簡單的外掛,允許您展示乾淨版面的專案資訊。簡約而精美,您可以點擊您的圖庫專案的每張圖片,選擇顯示更多細節,例如專案類...。
Essential Content Types 》Essential Content Types 是一個 WordPress 外掛程式,讓您可以在您的網站上以不同的內容/文章類型展示出優秀的內容。這些內容/文章類型可能會被 WordPress ...。