🔥 HOT: Changeset/ - High Quality

Changeset 3343244


Ignore:
Timestamp:
08/12/2025 03:34:33 AM (5 months ago)
Author:
mxp
Message:

update version

Location:
mxp-dev-tools
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • mxp-dev-tools/tags/3.3.6/index.php

    r3285988 r3343244  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.8
    9  * Stable tag: 3.3.5
    10  * Version: 3.3.5
     9 * Stable tag: 3.3.6
     10 * Version: 3.3.6
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939    use SearchReplace;
    4040    use Utility;
    41     static $VERSION = '3.3.5';
     41    static $VERSION = '3.3.6';
    4242    private $themeforest_api_base_url = 'https://api.envato.com/v3';
    4343    protected static $instance = null;
  • mxp-dev-tools/tags/3.3.6/mxp-login-path.php

    r3285988 r3343244  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.8
    9  * Stable tag: 3.3.5
    10  * Version: 3.3.5
     9 * Stable tag: 3.3.6
     10 * Version: 3.3.6
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/tags/3.3.6/mxp-site-manager.php

    r3285988 r3343244  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.8
    9  * Stable tag: 3.3.5
    10  * Version: 3.3.5
     9 * Stable tag: 3.3.6
     10 * Version: 3.3.6
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939class MDTSiteManager {
    4040    public $plugin_slug = 'mdt-site-manager';
    41     public static $VERSION = '3.3.5';
     41    public static $VERSION = '3.3.6';
    4242
    4343    public function __construct() {
  • mxp-dev-tools/tags/3.3.6/mxp-snippets.php

    r3285988 r3343244  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.8
    9  * Stable tag: 3.3.5
    10  * Version: 3.3.5
     9 * Stable tag: 3.3.6
     10 * Version: 3.3.6
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    114114// 單獨給指定的管理員開啟後台檔案形式操作,陣列指定管理員ID
    115115if (!defined('MDT_DISALLOW_FILE_MODS_ADMINS')) {
    116     define('MDT_DISALLOW_FILE_MODS_ADMINS', array(1));
     116    // 沒指定的話,預設先抓當前所有管理員
     117    global $wpdb;
     118
     119    $admin_ids = [];
     120
     121    // 當前站點的 capabilities meta_key
     122    $cap_meta_key = $wpdb->get_blog_prefix() . 'capabilities';
     123
     124    // 取得當前站點 Administrator ID
     125    $site_admin_ids = $wpdb->get_col($wpdb->prepare(
     126        "SELECT user_id
     127         FROM {$wpdb->usermeta}
     128         WHERE meta_key = %s
     129           AND meta_value LIKE %s",
     130        $cap_meta_key,
     131        '%\"administrator\"%'
     132    ));
     133    $admin_ids = array_merge($admin_ids, array_map('intval', $site_admin_ids));
     134
     135    // 如果是 Multisite,抓取 Super Admin
     136    if (is_multisite()) {
     137        // 取得 super admin 帳號名稱
     138        $super_admins = maybe_unserialize($wpdb->get_var($wpdb->prepare(
     139            "SELECT meta_value FROM {$wpdb->sitemeta} WHERE meta_key = %s",
     140            'site_admins'
     141        )));
     142
     143        if (is_array($super_admins) && $super_admins) {
     144            // 轉換 super admin 帳號名稱為 ID
     145            $placeholders = implode(',', array_fill(0, count($super_admins), '%s'));
     146            $sql = "SELECT ID FROM {$wpdb->users} WHERE user_login IN ($placeholders)";
     147            $super_admin_ids = $wpdb->get_col($wpdb->prepare($sql, ...$super_admins));
     148            $admin_ids = array_merge($admin_ids, array_map('intval', $super_admin_ids));
     149        }
     150    }
     151
     152    // 去重
     153    $admin_ids = array_values(array_unique($admin_ids));
     154    define('MDT_DISALLOW_FILE_MODS_ADMINS', $admin_ids);
    117155}
    118156// 顯示後台內容的系統編號