[WordPress] 外掛分享: occupied

首頁外掛目錄 › occupied
WordPress 外掛 occupied 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
全新外掛
安裝啟用
尚無評分
2959 天前
最後更新
問題解決
WordPress 4.8.1+ PHP 5.2.4+ v0.1.0 上架:2018-02-08

內容簡介

自訂 WordPress 後臺頁面鎖定外掛

用法

在自訂頁面的函式中使用 Occupied::protect() 啟用鎖定功能。

<?php
add_action('admin_menu', 'register_my_plugin_menu');

function register_my_plugin_menu(){
add_menu_page("My Cool Plugin", "cool-plugin", "manage_options", "my_cool_plugin_page", "render_my_cool_plugin", "dashicons-heart", 7);
}

function render_my_cool_plugin(){
// Occupied::protect 啟用當前頁面鎖定並返回鎖定數組
// 可選:傳入要在鎖定模式框中顯示的消息
$lock = Occupied::protect("Cool Plugin Occupied!");

echo "<h1>My Cool Plugin!</h1>";
}
?>

在其他操作中,您可以檢查當前用戶是否佔用屏幕

<?php
function some_other_action(){
if(Occupied::is_authorized('toplevel_page_my_cool_plugin_page')){
// 商務邏輯,保存到數據庫,等等..
}else{
// 返回錯誤
}
}
?><h3>待辦事項</h3>

* 拆分樣式
* 添加鎖定鉤子
* 重新考慮使用 Vue 作為模態框和部分事件處理程序

開發人員

此外掛在 GitHub 上開發

許可證

GPLv3

外掛標籤

開發者團隊

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

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

原文外掛簡介

custom page locking for WordPress admin screens
usage
In the function for your custom page, just use Occupied::protect() to enable locking on that page.
My Cool Plugin!

";
}
?>

In another action, you can check whether a screen is occupied by the current user

todo

* break out styles
* add locking hooks
* rethink using vue for a modal and some event handlers
developers
This plugin is developed on github
license
GPLv3

延伸相關外掛

文章
Filter
Apply Filters
Mastodon