[WordPress] 外掛分享: Customize Widgets Plus

首頁外掛目錄 › Customize Widgets Plus
10+
安裝啟用
尚無評分
3941 天前
最後更新
問題解決
v0.2 上架:2015-05-10

內容簡介

此外掛包含實驗性功能,以及用於小工具和自訂選項的改進測試平台。

需要 PHP 5.3+。

此外掛的開發是在 GitHub 上進行的。歡迎提交拉取請求。在前往外掛論壇之前,請查看在 GitHub 上報告的問題。

目前的功能:

非自動加載的小工具選項

小工具通常存儲在選項中。多小工具將它們的所有實例存儲在一個特定類型的大的序列化數組中。當有大量特定類型的小工具時,序列化數組的大小可能會很大。此外,WP_Widget 在調用 update_option() 之前並未明確執行 add_option(... 'no' ),因此所有設置都將與自動加載一起添加。在使用 Memcached 對象緩存時,這非常糟糕,具體原因是可以導致總 alloptions 緩存鍵變得大於 1MB,從而導致 Memcached 無法將值存儲在緩存中。在 WordPress.com 上的結果是一個 “Matt's fault” 錯誤,需要 VIP 團隊修復。不應將小工具設置存儲在序列化數組中。每個小工具實例都應存儲在自定義文章類型中。但在完成這項工作之前,我們應停止自動加載選項。參見 #26876 和 #23909。

小工具編號增加

實現 Core 問題的修復 #32183(小工具 ID 自動增量衝突對於同時使用的用戶)。存儲的 widget_number 選項為每次實例化小工具提供了一個集中式的自動增量編號,即使是尚未保存的 Customizer 中的小工具也是如此。

高效的多維度設置過濾

Core 中多維度選項和 theme_mods 的設置非常低效,因為註冊為 option 或 theme_mod 子集的所有 Customizer 設置都需要添加到整個值的過濾器中,這意味著對一個單獨的設置進行過濾器操作將導致該 option/theme_mod 中所有其他設置的所有過濾器也得到應用。此功能旨在最大程度地改善這一點,特別是對最糟糕的小工具進行改進。實現了對 #32103 的部分修復。

HTTPS 資源代理

當啟用 FORCE_SSL_ADMIN(例如在 WordPress.com 上)時,Customizer 也會使用 HTTPS 將網站加載到預覽 iframe 中。但是,如果引用的是未使用 HTTPS 的外部資源,則由於瀏覽器的安全模型會引發混合內容警告,因此將無法加載。此功能將嘗試通過基於 WordPress 的代理將任何 HTTP URL 重寫為 HTTPS URL。

小工具帖子

將小工具實例存儲在帖子中而不是選項中。由於提交的 #32474 修補程序,在樹幹中需要進行更改。即將推出更多詳細信息...

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Customize Widgets Plus」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin consists of lab features and a testbed for improvements to Widgets and the Customizer.
Requires PHP 5.3+.
Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.
Current features:
Non-Autoloaded Widget Options
Widgets are stored in options (normally). Multi-widgets store all of their instances in one big serialized array specific to that type. When there are many widgets of a given type, the size of the serialized array can grow very large. What’s more is that WP_Widget does not explicitly add_option(... 'no' ) before calling update_option(), and so all of the settings get added with autoloading. This is very bad when using Memcached Object Cache specifically because it can result in the total alloptions cache key to become larger than 1MB and result in Memcached failing to store the value in the cache. On WordPress.com the result is a “Matt’s fault” error which has to be fixed by the VIP team. Widget settings should not be stored in serialized arrays to begin with; each widget instance should be stored in a custom post type. But until this is done we should stop autoloading options. See also #26876 and #23909.
Widget Number Incrementing
Implements fixes for Core issue #32183 (Widget ID auto-increments conflict for concurrent users). The stored widget_number option provides a centralized auto-increment number for whenever a widget is instantiated, even widgets in the Customizer that are not yet saved.
Efficient Multidimensional Setting Sanitizing
Settings for multidimensional options and theme_mods are extremely inefficient to sanitize in Core because all of the Customizer settings registered for the subsets of the option or theme_mod need filters that are added to the entire value, meaning sanitizing one single setting will result in all filters for all other settings in that option/theme_mod will also get applied. This functionality seeks to improve this as much as possible, especially for widgets which are the worst offenders. Implements partial fix for #32103.
HTTPS Resource Proxy
When FORCE_SSL_ADMIN is enabled (such as on WordPress.com), the Customizer will load the site into the preview iframe using HTTPS as well. If, however, external resources are being referenced which are not HTTPS, they will fail to load due to the browser’s security model raise mixed content warnings. This functionality will attempt to rewrite any HTTP URLs to be HTTPS ones via a WordPress-based proxy.
Widget Posts
Store widget instances in posts instead of options. Requires trunk due to patch committed in #32474. More details forthcoming…

延伸相關外掛

文章
Filter
Apply Filters
Mastodon