Changeset 3072940
- Timestamp:
- 04/18/2024 09:38:57 AM (23 months ago)
- Location:
- mxp-dev-tools
- Files:
-
- 1 deleted
- 5 edited
- 18 copied
-
tags/3.1.0 (deleted)
-
tags/3.1.1 (copied) (copied from mxp-dev-tools/trunk)
-
tags/3.1.1/includes/assets/js/dashboard/app.js (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/dashboard/app.js)
-
tags/3.1.1/includes/assets/js/db-optimize/app.js (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/db-optimize/app.js)
-
tags/3.1.1/includes/assets/js/plugins-list/app.js (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/plugins-list/app.js)
-
tags/3.1.1/includes/assets/js/search-plugins/app.js (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/search-plugins/app.js)
-
tags/3.1.1/includes/assets/js/site-manager (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/site-manager)
-
tags/3.1.1/includes/assets/js/site-manager/app.js (copied) (copied from mxp-dev-tools/trunk/includes/assets/js/site-manager/app.js)
-
tags/3.1.1/includes/class_plugins_list_table.php (copied) (copied from mxp-dev-tools/trunk/includes/class_plugins_list_table.php)
-
tags/3.1.1/includes/db-optimize.php (copied) (copied from mxp-dev-tools/trunk/includes/db-optimize.php)
-
tags/3.1.1/includes/hooks-usage.php (copied) (copied from mxp-dev-tools/trunk/includes/hooks-usage.php)
-
tags/3.1.1/includes/plugins-list.php (copied) (copied from mxp-dev-tools/trunk/includes/plugins-list.php)
-
tags/3.1.1/includes/utility.php (copied) (copied from mxp-dev-tools/trunk/includes/utility.php)
-
tags/3.1.1/index.php (copied) (copied from mxp-dev-tools/trunk/index.php) (3 diffs)
-
tags/3.1.1/mxp-login-path.php (copied) (copied from mxp-dev-tools/trunk/mxp-login-path.php) (1 diff)
-
tags/3.1.1/mxp-site-manager.php (copied) (copied from mxp-dev-tools/trunk/mxp-site-manager.php) (2 diffs)
-
tags/3.1.1/mxp-snippets.php (copied) (copied from mxp-dev-tools/trunk/mxp-snippets.php) (3 diffs)
-
tags/3.1.1/readme.txt (copied) (copied from mxp-dev-tools/trunk/readme.txt) (2 diffs)
-
tags/3.1.1/uninstall.php (copied) (copied from mxp-dev-tools/trunk/uninstall.php)
-
trunk/index.php (modified) (3 diffs)
-
trunk/mxp-login-path.php (modified) (1 diff)
-
trunk/mxp-site-manager.php (modified) (2 diffs)
-
trunk/mxp-snippets.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mxp-dev-tools/tags/3.1.1/index.php
r3067305 r3072940 4 4 * Plugin URI: https://goo.gl/2gLq18 5 5 * Description: 一介資男の常用外掛整理與常用開發功能整合外掛。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 26 26 use SearchReplace; 27 27 use Utility; 28 static $VERSION = '3.1. 0';28 static $VERSION = '3.1.1'; 29 29 private $themeforest_api_base_url = 'https://api.envato.com/v3'; 30 30 protected static $instance = null; … … 86 86 add_submenu_page($this->plugin_slug, 'Themeforest List', 'Themeforest List', 'administrator', 'mxp-themeforest-list', array($this, 'themeforest_page_cb')); 87 87 add_submenu_page($this->plugin_slug, '調整內容作者工具', '調整內容作者工具', 'administrator', 'mxp-change-post-owner', array($this, 'changepostowner_page_cb')); 88 add_submenu_page($this->plugin_slug, '作者外掛列表', '作者外掛列表', 'administrator', 'mxp-author-plugins', array($this, 'listauthorplugin_page_cb'));88 // add_submenu_page($this->plugin_slug, '作者外掛列表', '作者外掛列表', 'administrator', 'mxp-author-plugins', array($this, 'listauthorplugin_page_cb')); 89 89 add_submenu_page($this->plugin_slug, '外掛搜尋工具', '外掛搜尋工具', 'administrator', 'mxp-search-plugins', array($this, 'searchplugin_page_cb')); 90 90 add_submenu_page($this->plugin_slug, '主題打包工具', '主題打包工具', 'administrator', 'mxp-theme-archive', array($this, 'themearchive_page_cb')); -
mxp-dev-tools/tags/3.1.1/mxp-login-path.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 隱藏後台登入位置工具。啟用即更改預設登入網址為 /admin-staff/ 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ -
mxp-dev-tools/tags/3.1.1/mxp-site-manager.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 管理多個 WordPress 站點的工具。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 35 35 class MDTSiteManager { 36 36 public $plugin_slug = 'mdt-site-manager'; 37 public static $VERSION = '3.1. 0';37 public static $VERSION = '3.1.1'; 38 38 39 39 public function __construct() { -
mxp-dev-tools/tags/3.1.1/mxp-snippets.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 整合 GitHub 中常用的程式碼片段。請注意,並非所有網站都適用全部的選項,有進階需求可以透過設定 wp-config.php 中此外掛預設常數,啟用或停用部分功能。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 325 325 if (isset($_REQUEST['opcache_reset']) && function_exists('opcache_reset')) { 326 326 opcache_reset(); 327 } 328 if (defined('MDT_DISALLOW_FILE_MODS_ADMINS') && is_array(MDT_DISALLOW_FILE_MODS_ADMINS)) { 329 add_filter('users_list_table_query_args', array($this, 'filter_user_query_qrgs'), 99999, 1); 330 add_filter('map_meta_cap', array($this, 'restrict_user_editing'), 99999, 4); 331 add_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3); 327 332 } 328 333 } … … 1065 1070 } 1066 1071 1072 public function filter_user_query_qrgs($args) { 1073 //Exclude superusers if the current user is not a superuser. 1074 $super_users = MDT_DISALLOW_FILE_MODS_ADMINS; 1075 if (empty($super_users)) { 1076 return $args; 1077 } 1078 1079 if (!in_array(get_current_user_id(), MDT_DISALLOW_FILE_MODS_ADMINS)) { 1080 $args['exclude'] = array_merge( 1081 isset($args['exclude']) ? $args['exclude'] : array(), 1082 $super_users 1083 ); 1084 1085 //Exclude hidden users even if specifically included. This can happen 1086 //when looking at the "None" view on the "Users" page (this view shows 1087 //users that have no role on the current site). 1088 if (isset($args['include']) && !empty($args['include'])) { 1089 $args['include'] = array_diff($args['include'], $super_users); 1090 if (empty($args['include'])) { 1091 unset($args['include']); 1092 } 1093 } 1094 } 1095 1096 return $args; 1097 } 1098 1099 public function restrict_user_editing($required_caps, $capability, $this_user_id, $args) { 1100 static $edit_user_caps = array('edit_user', 'delete_user', 'promote_user', 'remove_user'); 1101 if (!in_array($capability, $edit_user_caps) || !isset($args[0])) { 1102 return $required_caps; 1103 } 1104 1105 /** @var int The user that might be edited or deleted. */ 1106 $that_user_id = intval($args[0]); 1107 $this_user_id = intval($this_user_id); 1108 1109 if (in_array($that_user_id, MDT_DISALLOW_FILE_MODS_ADMINS) && !in_array($this_user_id, MDT_DISALLOW_FILE_MODS_ADMINS)) { 1110 return array_merge($required_caps, array('do_not_allow')); 1111 } 1112 1113 return $required_caps; 1114 } 1115 1116 public function filter_user_counts($result = null, $strategy = 'time', $site_id = null) { 1117 // 避免無限重複執行導致記憶體被吃光的問題 1118 remove_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3); 1119 1120 //Perform this filtering only on the "Users" page. 1121 if (!isset($GLOBALS['parent_file']) || ($GLOBALS['parent_file'] !== 'users.php')) { 1122 return $result; 1123 } 1124 1125 if (in_array(get_current_user_id(), MDT_DISALLOW_FILE_MODS_ADMINS)) { 1126 //This user can see other hidden users. 1127 return $result; 1128 } 1129 1130 $super_users = array(); 1131 foreach (MDT_DISALLOW_FILE_MODS_ADMINS as $index => $user_id) { 1132 $user_obj = get_user_by('id', $user_id); 1133 if ($user_obj) { 1134 $super_users[] = $user_obj; 1135 } 1136 } 1137 //Note the $site_id. We want the roles that each user has on the specified site. 1138 //This should normally be the current site, but it doesn't have to be. 1139 1140 if (empty($super_users)) { 1141 //There are no users that need to be hidden. 1142 return $result; 1143 } 1144 1145 $result = count_users($strategy, $site_id); 1146 1147 //Adjust the total number of users. 1148 $result['total_users'] -= count($super_users); 1149 1150 //For each hidden user, subtract one from each of the roles that the user has. 1151 foreach ($super_users as $user) { 1152 if (!empty($user->roles) && is_array($user->roles)) { 1153 foreach ($user->roles as $roleId) { 1154 if (isset($result['avail_roles'][$roleId])) { 1155 $result['avail_roles'][$roleId]--; 1156 if ($result['avail_roles'][$roleId] <= 0) { 1157 unset($result['avail_roles'][$roleId]); 1158 } 1159 } 1160 } 1161 } else if (isset($result['avail_roles']['none'])) { 1162 $result['avail_roles']['none']--; 1163 } 1164 } 1165 1166 return $result; 1167 } 1168 1067 1169 public function wp_diagnostic_info() { 1068 1170 global $table_prefix; -
mxp-dev-tools/tags/3.1.1/readme.txt
r3067305 r3072940 6 6 Requires PHP: 5.6 7 7 Tested up to: 6.5 8 Stable tag: 3.1. 08 Stable tag: 3.1.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 79 79 == Changelog == 80 81 = 3.1.1 = 82 83 * 新增 Snipets 中預設把特殊管理權限的使用者隱藏 84 * 關閉 作者外掛列表 頁籤 80 85 81 86 = 3.1.0 = -
mxp-dev-tools/trunk/index.php
r3067305 r3072940 4 4 * Plugin URI: https://goo.gl/2gLq18 5 5 * Description: 一介資男の常用外掛整理與常用開發功能整合外掛。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 26 26 use SearchReplace; 27 27 use Utility; 28 static $VERSION = '3.1. 0';28 static $VERSION = '3.1.1'; 29 29 private $themeforest_api_base_url = 'https://api.envato.com/v3'; 30 30 protected static $instance = null; … … 86 86 add_submenu_page($this->plugin_slug, 'Themeforest List', 'Themeforest List', 'administrator', 'mxp-themeforest-list', array($this, 'themeforest_page_cb')); 87 87 add_submenu_page($this->plugin_slug, '調整內容作者工具', '調整內容作者工具', 'administrator', 'mxp-change-post-owner', array($this, 'changepostowner_page_cb')); 88 add_submenu_page($this->plugin_slug, '作者外掛列表', '作者外掛列表', 'administrator', 'mxp-author-plugins', array($this, 'listauthorplugin_page_cb'));88 // add_submenu_page($this->plugin_slug, '作者外掛列表', '作者外掛列表', 'administrator', 'mxp-author-plugins', array($this, 'listauthorplugin_page_cb')); 89 89 add_submenu_page($this->plugin_slug, '外掛搜尋工具', '外掛搜尋工具', 'administrator', 'mxp-search-plugins', array($this, 'searchplugin_page_cb')); 90 90 add_submenu_page($this->plugin_slug, '主題打包工具', '主題打包工具', 'administrator', 'mxp-theme-archive', array($this, 'themearchive_page_cb')); -
mxp-dev-tools/trunk/mxp-login-path.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 隱藏後台登入位置工具。啟用即更改預設登入網址為 /admin-staff/ 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ -
mxp-dev-tools/trunk/mxp-site-manager.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 管理多個 WordPress 站點的工具。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 35 35 class MDTSiteManager { 36 36 public $plugin_slug = 'mdt-site-manager'; 37 public static $VERSION = '3.1. 0';37 public static $VERSION = '3.1.1'; 38 38 39 39 public function __construct() { -
mxp-dev-tools/trunk/mxp-snippets.php
r3067305 r3072940 4 4 * Plugin URI: https://tw.wordpress.org/plugins/mxp-dev-tools/ 5 5 * Description: 整合 GitHub 中常用的程式碼片段。請注意,並非所有網站都適用全部的選項,有進階需求可以透過設定 wp-config.php 中此外掛預設常數,啟用或停用部分功能。 6 * Version: 3.1. 06 * Version: 3.1.1 7 7 * Author: Chun 8 8 * Author URI: https://www.mxp.tw/contact/ … … 325 325 if (isset($_REQUEST['opcache_reset']) && function_exists('opcache_reset')) { 326 326 opcache_reset(); 327 } 328 if (defined('MDT_DISALLOW_FILE_MODS_ADMINS') && is_array(MDT_DISALLOW_FILE_MODS_ADMINS)) { 329 add_filter('users_list_table_query_args', array($this, 'filter_user_query_qrgs'), 99999, 1); 330 add_filter('map_meta_cap', array($this, 'restrict_user_editing'), 99999, 4); 331 add_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3); 327 332 } 328 333 } … … 1065 1070 } 1066 1071 1072 public function filter_user_query_qrgs($args) { 1073 //Exclude superusers if the current user is not a superuser. 1074 $super_users = MDT_DISALLOW_FILE_MODS_ADMINS; 1075 if (empty($super_users)) { 1076 return $args; 1077 } 1078 1079 if (!in_array(get_current_user_id(), MDT_DISALLOW_FILE_MODS_ADMINS)) { 1080 $args['exclude'] = array_merge( 1081 isset($args['exclude']) ? $args['exclude'] : array(), 1082 $super_users 1083 ); 1084 1085 //Exclude hidden users even if specifically included. This can happen 1086 //when looking at the "None" view on the "Users" page (this view shows 1087 //users that have no role on the current site). 1088 if (isset($args['include']) && !empty($args['include'])) { 1089 $args['include'] = array_diff($args['include'], $super_users); 1090 if (empty($args['include'])) { 1091 unset($args['include']); 1092 } 1093 } 1094 } 1095 1096 return $args; 1097 } 1098 1099 public function restrict_user_editing($required_caps, $capability, $this_user_id, $args) { 1100 static $edit_user_caps = array('edit_user', 'delete_user', 'promote_user', 'remove_user'); 1101 if (!in_array($capability, $edit_user_caps) || !isset($args[0])) { 1102 return $required_caps; 1103 } 1104 1105 /** @var int The user that might be edited or deleted. */ 1106 $that_user_id = intval($args[0]); 1107 $this_user_id = intval($this_user_id); 1108 1109 if (in_array($that_user_id, MDT_DISALLOW_FILE_MODS_ADMINS) && !in_array($this_user_id, MDT_DISALLOW_FILE_MODS_ADMINS)) { 1110 return array_merge($required_caps, array('do_not_allow')); 1111 } 1112 1113 return $required_caps; 1114 } 1115 1116 public function filter_user_counts($result = null, $strategy = 'time', $site_id = null) { 1117 // 避免無限重複執行導致記憶體被吃光的問題 1118 remove_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3); 1119 1120 //Perform this filtering only on the "Users" page. 1121 if (!isset($GLOBALS['parent_file']) || ($GLOBALS['parent_file'] !== 'users.php')) { 1122 return $result; 1123 } 1124 1125 if (in_array(get_current_user_id(), MDT_DISALLOW_FILE_MODS_ADMINS)) { 1126 //This user can see other hidden users. 1127 return $result; 1128 } 1129 1130 $super_users = array(); 1131 foreach (MDT_DISALLOW_FILE_MODS_ADMINS as $index => $user_id) { 1132 $user_obj = get_user_by('id', $user_id); 1133 if ($user_obj) { 1134 $super_users[] = $user_obj; 1135 } 1136 } 1137 //Note the $site_id. We want the roles that each user has on the specified site. 1138 //This should normally be the current site, but it doesn't have to be. 1139 1140 if (empty($super_users)) { 1141 //There are no users that need to be hidden. 1142 return $result; 1143 } 1144 1145 $result = count_users($strategy, $site_id); 1146 1147 //Adjust the total number of users. 1148 $result['total_users'] -= count($super_users); 1149 1150 //For each hidden user, subtract one from each of the roles that the user has. 1151 foreach ($super_users as $user) { 1152 if (!empty($user->roles) && is_array($user->roles)) { 1153 foreach ($user->roles as $roleId) { 1154 if (isset($result['avail_roles'][$roleId])) { 1155 $result['avail_roles'][$roleId]--; 1156 if ($result['avail_roles'][$roleId] <= 0) { 1157 unset($result['avail_roles'][$roleId]); 1158 } 1159 } 1160 } 1161 } else if (isset($result['avail_roles']['none'])) { 1162 $result['avail_roles']['none']--; 1163 } 1164 } 1165 1166 return $result; 1167 } 1168 1067 1169 public function wp_diagnostic_info() { 1068 1170 global $table_prefix; -
mxp-dev-tools/trunk/readme.txt
r3067305 r3072940 6 6 Requires PHP: 5.6 7 7 Tested up to: 6.5 8 Stable tag: 3.1. 08 Stable tag: 3.1.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 79 79 == Changelog == 80 81 = 3.1.1 = 82 83 * 新增 Snipets 中預設把特殊管理權限的使用者隱藏 84 * 關閉 作者外掛列表 頁籤 80 85 81 86 = 3.1.0 =
Note: See TracChangeset
for help on using the changeset viewer.