mirror of
https://github.com/WPMultisite/wp-multisite-dashboard.git
synced 2025-08-07 14:59:14 +08:00
v1.2.2 稳定版
首发正式版本
This commit is contained in:
parent
836b293850
commit
a8c3a0b96d
20 changed files with 5001 additions and 4432 deletions
|
@ -1,36 +1,42 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
if (!defined("ABSPATH")) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$contact_info = get_site_option('msd_contact_info', [
|
||||
'name' => get_network_option(null, 'site_name'),
|
||||
'email' => get_network_option(null, 'admin_email'),
|
||||
'phone' => '',
|
||||
'website' => network_home_url(),
|
||||
'description' => 'Network Administrator Contact Information',
|
||||
'qq' => '',
|
||||
'wechat' => '',
|
||||
'whatsapp' => '',
|
||||
'telegram' => '',
|
||||
'qr_code' => ''
|
||||
$contact_info = get_site_option("msd_contact_info", [
|
||||
"name" => get_network_option(null, "site_name"),
|
||||
"email" => get_network_option(null, "admin_email"),
|
||||
"phone" => "",
|
||||
"website" => network_home_url(),
|
||||
"description" => __(
|
||||
"Network Administrator Contact Information",
|
||||
"wp-multisite-dashboard"
|
||||
),
|
||||
"qq" => "",
|
||||
"wechat" => "",
|
||||
"whatsapp" => "",
|
||||
"telegram" => "",
|
||||
"qr_code" => "",
|
||||
]);
|
||||
|
||||
$news_sources = get_site_option('msd_news_sources', [
|
||||
$news_sources = get_site_option("msd_news_sources", [
|
||||
[
|
||||
'name' => 'WordPress News',
|
||||
'url' => 'https://wordpress.org/news/feed/',
|
||||
'enabled' => true
|
||||
]
|
||||
"name" => __("WordPress News", "wp-multisite-dashboard"),
|
||||
"url" => "https://wordpress.org/news/feed/",
|
||||
"enabled" => true,
|
||||
],
|
||||
]);
|
||||
|
||||
$quick_links = get_site_option('msd_quick_links', []);
|
||||
$quick_links = get_site_option("msd_quick_links", []);
|
||||
?>
|
||||
|
||||
<div id="msd-contact-info-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Edit Contact Information', 'wp-multisite-dashboard'); ?></h3>
|
||||
<h3><?php _e(
|
||||
"Edit Contact Information",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideContactInfoModal()">×</button>
|
||||
</div>
|
||||
|
||||
|
@ -38,28 +44,59 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-contact-form">
|
||||
<div class="msd-form-section">
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Organization Name:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="text" id="msd-contact-name" value="<?php echo esc_attr($contact_info['name']); ?>" placeholder="<?php esc_attr_e('Network Administrator', 'wp-multisite-dashboard'); ?>">
|
||||
<label><?php _e(
|
||||
"Organization Name:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<input type="text" id="msd-contact-name" value="<?php echo esc_attr(
|
||||
$contact_info["name"]
|
||||
); ?>" placeholder="<?php esc_attr_e(
|
||||
"Network Administrator",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Email:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="email" id="msd-contact-email" value="<?php echo esc_attr($contact_info['email']); ?>" placeholder="admin@example.com">
|
||||
<label><?php _e(
|
||||
"Email:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<input type="email" id="msd-contact-email" value="<?php echo esc_attr(
|
||||
$contact_info["email"]
|
||||
); ?>" placeholder="admin@example.com">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Phone:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="text" id="msd-contact-phone" value="<?php echo esc_attr($contact_info['phone']); ?>" placeholder="+1 234 567 8900">
|
||||
<label><?php _e(
|
||||
"Phone:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<input type="text" id="msd-contact-phone" value="<?php echo esc_attr(
|
||||
$contact_info["phone"]
|
||||
); ?>" placeholder="+1 234 567 8900">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Website:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="url" id="msd-contact-website" value="<?php echo esc_attr($contact_info['website']); ?>" placeholder="https://example.com">
|
||||
<label><?php _e(
|
||||
"Website:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<input type="url" id="msd-contact-website" value="<?php echo esc_attr(
|
||||
$contact_info["website"]
|
||||
); ?>" placeholder="https://example.com">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Description:', 'wp-multisite-dashboard'); ?></label>
|
||||
<textarea id="msd-contact-description" placeholder="<?php esc_attr_e('Brief description or role', 'wp-multisite-dashboard'); ?>"><?php echo esc_textarea($contact_info['description']); ?></textarea>
|
||||
<label><?php _e(
|
||||
"Description:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<textarea id="msd-contact-description" placeholder="<?php esc_attr_e(
|
||||
"Brief description or role",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>"><?php echo esc_textarea(
|
||||
$contact_info["description"]
|
||||
); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -68,17 +105,27 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-admin-users"></span>
|
||||
<?php _e('QQ:', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("QQ:", "wp-multisite-dashboard"); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-qq" value="<?php echo esc_attr($contact_info['qq']); ?>" placeholder="1234567890">
|
||||
<input type="text" id="msd-contact-qq" value="<?php echo esc_attr(
|
||||
$contact_info["qq"]
|
||||
); ?>" placeholder="1234567890">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-format-chat"></span>
|
||||
<?php _e('WeChat:', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"WeChat:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-wechat" value="<?php echo esc_attr($contact_info['wechat']); ?>" placeholder="WeChat_ID">
|
||||
<input type="text" id="msd-contact-wechat" value="<?php echo esc_attr(
|
||||
$contact_info["wechat"]
|
||||
); ?>" placeholder="<?php esc_attr_e(
|
||||
"WeChat ID",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -86,32 +133,62 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-smartphone"></span>
|
||||
<?php _e('WhatsApp:', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"WhatsApp:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-whatsapp" value="<?php echo esc_attr($contact_info['whatsapp']); ?>" placeholder="+1234567890">
|
||||
<input type="text" id="msd-contact-whatsapp" value="<?php echo esc_attr(
|
||||
$contact_info["whatsapp"]
|
||||
); ?>" placeholder="+1234567890">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-email-alt"></span>
|
||||
<?php _e('Telegram:', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"Telegram:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-telegram" value="<?php echo esc_attr($contact_info['telegram']); ?>" placeholder="@username">
|
||||
<input type="text" id="msd-contact-telegram" value="<?php echo esc_attr(
|
||||
$contact_info["telegram"]
|
||||
); ?>" placeholder="@username">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-form-section">
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('QR Code Image URL:', 'wp-multisite-dashboard'); ?></label>
|
||||
<label><?php _e(
|
||||
"QR Code Image URL:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></label>
|
||||
<div class="msd-qr-input-group">
|
||||
<input type="url" id="msd-contact-qr-code" value="<?php echo esc_attr($contact_info['qr_code']); ?>" placeholder="https://example.com/qr-code.png">
|
||||
<button type="button" class="button" onclick="MSD.selectQRImage()"><?php _e('Select Image', 'wp-multisite-dashboard'); ?></button>
|
||||
<input type="url" id="msd-contact-qr-code" value="<?php echo esc_attr(
|
||||
$contact_info["qr_code"]
|
||||
); ?>" placeholder="https://example.com/qr-code.png">
|
||||
<button type="button" class="button" onclick="MSD.selectQRImage()"><?php _e(
|
||||
"Select Image",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></button>
|
||||
</div>
|
||||
<p class="description"><?php _e('Upload or provide URL for a QR code image (WeChat, contact info, etc.)', 'wp-multisite-dashboard'); ?></p>
|
||||
<p class="description"><?php _e(
|
||||
"Upload or provide URL for a QR code image (WeChat, contact info, etc.)",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
|
||||
<div id="msd-qr-preview" class="msd-qr-preview" style="<?php echo empty($contact_info['qr_code']) ? 'display: none;' : ''; ?>">
|
||||
<img src="<?php echo esc_url($contact_info['qr_code']); ?>" alt="QR Code Preview" class="msd-qr-preview-img">
|
||||
<div id="msd-qr-preview" class="msd-qr-preview" style="<?php echo empty(
|
||||
$contact_info["qr_code"]
|
||||
)
|
||||
? "display: none;"
|
||||
: ""; ?>">
|
||||
<img src="<?php echo esc_url(
|
||||
$contact_info["qr_code"]
|
||||
); ?>" alt="<?php esc_attr_e(
|
||||
"QR Code Preview",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>" class="msd-qr-preview-img">
|
||||
<button type="button" class="msd-qr-remove" onclick="MSD.removeQRCode()">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -121,10 +198,10 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveContactInfo()">
|
||||
<?php _e('Save Contact Info', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Save Contact Info", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideContactInfoModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Cancel", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -133,7 +210,10 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div id="msd-news-sources-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Configure News Sources', 'wp-multisite-dashboard'); ?></h3>
|
||||
<h3><?php _e(
|
||||
"Configure News Sources",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideNewsSourcesModal()">×</button>
|
||||
</div>
|
||||
|
||||
|
@ -144,13 +224,23 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-news-source-item">
|
||||
<div class="msd-source-row">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('Source Name', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($source['name']); ?>"
|
||||
placeholder="<?php esc_attr_e(
|
||||
"Source Name",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>"
|
||||
value="<?php echo esc_attr(
|
||||
$source["name"]
|
||||
); ?>"
|
||||
class="msd-news-name"
|
||||
required>
|
||||
<input type="url"
|
||||
placeholder="<?php esc_attr_e('RSS Feed URL', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_url($source['url']); ?>"
|
||||
placeholder="<?php esc_attr_e(
|
||||
"RSS Feed URL",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>"
|
||||
value="<?php echo esc_url(
|
||||
$source["url"]
|
||||
); ?>"
|
||||
class="msd-news-url"
|
||||
required>
|
||||
</div>
|
||||
|
@ -159,12 +249,20 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<label class="msd-checkbox-label">
|
||||
<input type="checkbox"
|
||||
class="msd-news-enabled"
|
||||
<?php checked(!empty($source['enabled'])); ?>>
|
||||
<?php _e('Enabled', 'wp-multisite-dashboard'); ?>
|
||||
<?php checked(
|
||||
!empty($source["enabled"])
|
||||
); ?>>
|
||||
<?php _e(
|
||||
"Enabled",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</label>
|
||||
|
||||
<button type="button" class="msd-remove-source">
|
||||
<?php _e('Remove', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"Remove",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -175,22 +273,37 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-add-source-section">
|
||||
<button type="button" id="msd-add-news-source" class="button button-secondary">
|
||||
<span class="dashicons dashicons-plus-alt"></span>
|
||||
<?php _e('Add News Source', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Add News Source", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-news-help">
|
||||
<h4><?php _e('Popular RSS Feeds', 'wp-multisite-dashboard'); ?></h4>
|
||||
<h4><?php _e(
|
||||
"Popular RSS Feeds",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h4>
|
||||
<div class="msd-rss-suggestions">
|
||||
<div class="msd-rss-suggestion">
|
||||
<strong>WenPai.org News</strong>
|
||||
<strong><?php _e(
|
||||
"WenPai.org News",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></strong>
|
||||
<code>https://wenpai.org/news/feed/</code>
|
||||
<span class="msd-rss-desc">Official WenPai.org news and updates</span>
|
||||
<span class="msd-rss-desc"><?php _e(
|
||||
"Official WenPai.org news and updates",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
<div class="msd-rss-suggestion">
|
||||
<strong>WP TEA</strong>
|
||||
<strong><?php _e(
|
||||
"WP TEA",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></strong>
|
||||
<code>https://wptea.com/feed</code>
|
||||
<span class="msd-rss-desc">WordPress China community news and insights</span>
|
||||
<span class="msd-rss-desc"><?php _e(
|
||||
"WordPress China community news and insights",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -198,10 +311,10 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveNewsSources()">
|
||||
<?php _e('Save News Sources', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Save News Sources", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideNewsSourcesModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Cancel", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -210,7 +323,10 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div id="msd-quick-links-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Configure Quick Links', 'wp-multisite-dashboard'); ?></h3>
|
||||
<h3><?php _e(
|
||||
"Configure Quick Links",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideQuickLinksModal()">×</button>
|
||||
</div>
|
||||
|
||||
|
@ -221,33 +337,56 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-link-item">
|
||||
<div class="msd-link-row">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('Link Title', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($link['title']); ?>"
|
||||
placeholder="<?php esc_attr_e(
|
||||
"Link Title",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>"
|
||||
value="<?php echo esc_attr(
|
||||
$link["title"]
|
||||
); ?>"
|
||||
class="msd-link-title"
|
||||
required>
|
||||
<input type="url"
|
||||
placeholder="https://example.com"
|
||||
value="<?php echo esc_url($link['url']); ?>"
|
||||
value="<?php echo esc_url(
|
||||
$link["url"]
|
||||
); ?>"
|
||||
class="msd-link-url"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="msd-link-options">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('dashicons-admin-home or 🏠', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($link['icon']); ?>"
|
||||
placeholder="<?php esc_attr_e(
|
||||
"dashicons-admin-home or 🏠",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>"
|
||||
value="<?php echo esc_attr(
|
||||
$link["icon"]
|
||||
); ?>"
|
||||
class="msd-link-icon"
|
||||
title="<?php esc_attr_e('Icon (Dashicon class or emoji)', 'wp-multisite-dashboard'); ?>">
|
||||
title="<?php esc_attr_e(
|
||||
"Icon (Dashicon class or emoji)",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>">
|
||||
|
||||
<label class="msd-checkbox-label">
|
||||
<input type="checkbox"
|
||||
class="msd-link-newtab"
|
||||
<?php checked(!empty($link['new_tab'])); ?>>
|
||||
<?php _e('Open in new tab', 'wp-multisite-dashboard'); ?>
|
||||
<?php checked(
|
||||
!empty($link["new_tab"])
|
||||
); ?>>
|
||||
<?php _e(
|
||||
"Open in new tab",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</label>
|
||||
|
||||
<button type="button" class="msd-remove-link">
|
||||
<?php _e('Remove', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"Remove",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -258,64 +397,100 @@ $quick_links = get_site_option('msd_quick_links', []);
|
|||
<div class="msd-add-link-section">
|
||||
<button type="button" id="msd-add-link" class="button button-secondary">
|
||||
<span class="dashicons dashicons-plus-alt"></span>
|
||||
<?php _e('Add Link', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Add Link", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-quick-links-help">
|
||||
<h4><?php _e('Icon Options', 'wp-multisite-dashboard'); ?></h4>
|
||||
<h4><?php _e("Icon Options", "wp-multisite-dashboard"); ?></h4>
|
||||
|
||||
<div class="msd-icon-types">
|
||||
<div class="msd-icon-type-section">
|
||||
<h5><?php _e('WordPress Dashicons', 'wp-multisite-dashboard'); ?></h5>
|
||||
<h5><?php _e(
|
||||
"WordPress Dashicons",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h5>
|
||||
<div class="msd-icon-examples">
|
||||
<div class="msd-icon-example">
|
||||
<span class="dashicons dashicons-admin-home"></span>
|
||||
<code>dashicons-admin-home</code>
|
||||
<span><?php _e('Home', 'wp-multisite-dashboard'); ?></span>
|
||||
<span><?php _e(
|
||||
"Home",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
<div class="msd-icon-example">
|
||||
<span class="dashicons dashicons-chart-bar"></span>
|
||||
<code>dashicons-chart-bar</code>
|
||||
<span><?php _e('Analytics', 'wp-multisite-dashboard'); ?></span>
|
||||
<span><?php _e(
|
||||
"Analytics",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-icon-type-section">
|
||||
<h5><?php _e('Emojis', 'wp-multisite-dashboard'); ?></h5>
|
||||
<h5><?php _e(
|
||||
"Emojis",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h5>
|
||||
<div class="msd-icon-examples">
|
||||
<div class="msd-icon-example">
|
||||
<span class="msd-emoji">🏠</span>
|
||||
<code>🏠</code>
|
||||
<span><?php _e('Home', 'wp-multisite-dashboard'); ?></span>
|
||||
<span><?php _e(
|
||||
"Home",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
<div class="msd-icon-example">
|
||||
<span class="msd-emoji">⚙️</span>
|
||||
<code>⚙️</code>
|
||||
<span><?php _e('Settings', 'wp-multisite-dashboard'); ?></span>
|
||||
<span><?php _e(
|
||||
"Settings",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="description">
|
||||
<strong><?php _e('Dashicons:', 'wp-multisite-dashboard'); ?></strong> <?php _e('Built into WordPress, always available. Use format:', 'wp-multisite-dashboard'); ?> <code>dashicons-icon-name</code><br>
|
||||
<strong><?php _e('Emojis:', 'wp-multisite-dashboard'); ?></strong> <?php _e('Copy and paste emoji directly. Works on all devices.', 'wp-multisite-dashboard'); ?>
|
||||
<strong><?php _e(
|
||||
"Dashicons:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></strong> <?php _e(
|
||||
"Built into WordPress, always available. Use format:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?> <code>dashicons-icon-name</code><br>
|
||||
<strong><?php _e(
|
||||
"Emojis:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></strong> <?php _e(
|
||||
"Copy and paste emoji directly. Works on all devices.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</p>
|
||||
|
||||
<p class="description">
|
||||
<?php printf(__('Find more Dashicons at %s', 'wp-multisite-dashboard'), '<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">developer.wordpress.org/resource/dashicons/</a>'); ?>
|
||||
<?php printf(
|
||||
__(
|
||||
"Find more Dashicons at %s",
|
||||
"wp-multisite-dashboard"
|
||||
),
|
||||
'<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">developer.wordpress.org/resource/dashicons/</a>'
|
||||
); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveQuickLinks()">
|
||||
<?php _e('Save Links', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Save Links", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideQuickLinksModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Cancel", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,308 +0,0 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$contact_info = get_site_option('msd_contact_info', [
|
||||
'name' => get_network_option(null, 'site_name'),
|
||||
'email' => get_network_option(null, 'admin_email'),
|
||||
'phone' => '',
|
||||
'website' => network_home_url(),
|
||||
'description' => 'Network Administrator Contact Information',
|
||||
'qq' => '',
|
||||
'wechat' => '',
|
||||
'whatsapp' => '',
|
||||
'telegram' => '',
|
||||
'qr_code' => ''
|
||||
]);
|
||||
?>
|
||||
|
||||
<div id="msd-contact-info-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Edit Contact Information', 'wp-multisite-dashboard'); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideContactInfoModal()">×</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-body">
|
||||
<div class="msd-contact-form">
|
||||
<div class="msd-form-section">
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Organization Name:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="text" id="msd-contact-name" value="<?php echo esc_attr($contact_info['name']); ?>" placeholder="<?php esc_attr_e('Network Administrator', 'wp-multisite-dashboard'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Email:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="email" id="msd-contact-email" value="<?php echo esc_attr($contact_info['email']); ?>" placeholder="admin@example.com">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Phone:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="text" id="msd-contact-phone" value="<?php echo esc_attr($contact_info['phone']); ?>" placeholder="+1 234 567 8900">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Website:', 'wp-multisite-dashboard'); ?></label>
|
||||
<input type="url" id="msd-contact-website" value="<?php echo esc_attr($contact_info['website']); ?>" placeholder="https://example.com">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('Description:', 'wp-multisite-dashboard'); ?></label>
|
||||
<textarea id="msd-contact-description" placeholder="<?php esc_attr_e('Brief description or role', 'wp-multisite-dashboard'); ?>"><?php echo esc_textarea($contact_info['description']); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-form-section">
|
||||
<div class="msd-form-grid">
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-admin-users"></span>
|
||||
<?php _e('QQ:', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-qq" value="<?php echo esc_attr($contact_info['qq']); ?>" placeholder="1234567890">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-format-chat"></span>
|
||||
<?php _e('WeChat:', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-wechat" value="<?php echo esc_attr($contact_info['wechat']); ?>" placeholder="WeChat_ID">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-form-grid">
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-smartphone"></span>
|
||||
<?php _e('WhatsApp:', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-whatsapp" value="<?php echo esc_attr($contact_info['whatsapp']); ?>" placeholder="+1234567890">
|
||||
</div>
|
||||
|
||||
<div class="msd-form-field">
|
||||
<label>
|
||||
<span class="dashicons dashicons-email-alt"></span>
|
||||
<?php _e('Telegram:', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
<input type="text" id="msd-contact-telegram" value="<?php echo esc_attr($contact_info['telegram']); ?>" placeholder="@username">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-form-section">
|
||||
<div class="msd-form-field">
|
||||
<label><?php _e('QR Code Image URL:', 'wp-multisite-dashboard'); ?></label>
|
||||
<div class="msd-qr-input-group">
|
||||
<input type="url" id="msd-contact-qr-code" value="<?php echo esc_attr($contact_info['qr_code']); ?>" placeholder="https://example.com/qr-code.png">
|
||||
<button type="button" class="button" onclick="MSD.selectQRImage()"><?php _e('Select Image', 'wp-multisite-dashboard'); ?></button>
|
||||
</div>
|
||||
<p class="description"><?php _e('Upload or provide URL for a QR code image (WeChat, contact info, etc.)', 'wp-multisite-dashboard'); ?></p>
|
||||
|
||||
<div id="msd-qr-preview" class="msd-qr-preview" style="<?php echo empty($contact_info['qr_code']) ? 'display: none;' : ''; ?>">
|
||||
<img src="<?php echo esc_url($contact_info['qr_code']); ?>" alt="QR Code Preview" class="msd-qr-preview-img">
|
||||
<button type="button" class="msd-qr-remove" onclick="MSD.removeQRCode()">×</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveContactInfo()">
|
||||
<?php _e('Save Contact Info', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideContactInfoModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.msd-modal-intro {
|
||||
margin-bottom: 24px;
|
||||
padding: 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-modal-intro p {
|
||||
margin: 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.msd-contact-form {
|
||||
display: grid;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.msd-form-section {
|
||||
padding: 16px;
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
background: var(--msd-bg-light);
|
||||
}
|
||||
|
||||
.msd-form-section h4 {
|
||||
margin: 0 0 16px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-bottom: 1px solid var(--msd-border);
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.msd-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.msd-form-field {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.msd-form-field:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.msd-form-field label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: 500;
|
||||
color: var(--msd-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.msd-form-field label .dashicons {
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
color: var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-form-field input,
|
||||
.msd-form-field textarea {
|
||||
width: 100%;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius-small);
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-form-field input:focus,
|
||||
.msd-form-field textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--msd-primary);
|
||||
box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
|
||||
}
|
||||
|
||||
.msd-form-field textarea {
|
||||
min-height: 80px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.msd-qr-input-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.msd-qr-input-group input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.msd-qr-input-group .button {
|
||||
flex-shrink: 0;
|
||||
padding: 4px 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.msd-qr-preview {
|
||||
margin-top: 12px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
padding: 8px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.msd-qr-preview-img {
|
||||
max-width: 120px;
|
||||
max-height: 120px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.msd-qr-remove {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--msd-danger);
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-qr-remove:hover {
|
||||
background: #c82333;
|
||||
}
|
||||
|
||||
.msd-form-field .description {
|
||||
margin: 6px 0 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--msd-text-light);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.msd-contact-qr {
|
||||
text-align: center;
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--msd-bg);
|
||||
}
|
||||
|
||||
.msd-qr-image {
|
||||
max-width: 100%;
|
||||
max-height: 200px;
|
||||
border: 1px solid var(--msd-border);
|
||||
padding: 12px;
|
||||
background: var(--msd-bg);
|
||||
border-radius: var(--msd-radius-small);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.msd-form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.msd-qr-input-group {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.msd-modal-content {
|
||||
margin: 20px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,279 +0,0 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$news_sources = get_site_option('msd_news_sources', [
|
||||
[
|
||||
'name' => 'WordPress News',
|
||||
'url' => 'https://wordpress.org/news/feed/',
|
||||
'enabled' => true
|
||||
]
|
||||
]);
|
||||
?>
|
||||
|
||||
<div id="msd-news-sources-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Configure News Sources', 'wp-multisite-dashboard'); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideNewsSourcesModal()">×</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-body">
|
||||
<div id="msd-news-sources-editor">
|
||||
<?php if (!empty($news_sources)): ?>
|
||||
<?php foreach ($news_sources as $index => $source): ?>
|
||||
<div class="msd-news-source-item">
|
||||
<div class="msd-source-row">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('Source Name', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($source['name']); ?>"
|
||||
class="msd-news-name"
|
||||
required>
|
||||
<input type="url"
|
||||
placeholder="<?php esc_attr_e('RSS Feed URL', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_url($source['url']); ?>"
|
||||
class="msd-news-url"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="msd-source-options">
|
||||
<label class="msd-checkbox-label">
|
||||
<input type="checkbox"
|
||||
class="msd-news-enabled"
|
||||
<?php checked(!empty($source['enabled'])); ?>>
|
||||
<?php _e('Enabled', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
|
||||
<button type="button" class="msd-remove-source">
|
||||
<?php _e('Remove', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="msd-add-source-section">
|
||||
<button type="button" id="msd-add-news-source" class="button button-secondary">
|
||||
<span class="dashicons dashicons-plus-alt"></span>
|
||||
<?php _e('Add News Source', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveNewsSources()">
|
||||
<?php _e('Save News Sources', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideNewsSourcesModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.msd-modal-intro {
|
||||
margin-bottom: 20px;
|
||||
padding: 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-modal-intro p {
|
||||
margin: 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.msd-news-source-item {
|
||||
margin-bottom: 16px;
|
||||
padding: 16px;
|
||||
background: var(--msd-bg);
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-news-source-item:hover {
|
||||
border-color: var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-source-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.msd-source-options {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.msd-news-name,
|
||||
.msd-news-url {
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius-small);
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-news-name:focus,
|
||||
.msd-news-url:focus {
|
||||
outline: none;
|
||||
border-color: var(--msd-primary);
|
||||
box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
|
||||
}
|
||||
|
||||
.msd-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: var(--msd-text);
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.msd-checkbox-label input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.msd-add-source-section {
|
||||
text-align: center;
|
||||
margin: 24px 0;
|
||||
padding: 16px;
|
||||
border: 2px dashed var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-add-source-section:hover {
|
||||
border-color: var(--msd-primary);
|
||||
}
|
||||
|
||||
#msd-add-news-source {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.msd-news-help {
|
||||
margin-top: 24px;
|
||||
padding: 16px;
|
||||
background: #f8f9fa;
|
||||
border-radius: var(--msd-radius);
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-news-help h4 {
|
||||
margin: 0 0 12px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.msd-news-help h5 {
|
||||
margin: 16px 0 8px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.msd-rss-suggestions {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.msd-rss-suggestion {
|
||||
display: grid;
|
||||
grid-template-columns: 120px 1fr;
|
||||
gap: 8px;
|
||||
padding: 8px;
|
||||
background: white;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.msd-rss-suggestion strong {
|
||||
color: var(--msd-text);
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.msd-rss-suggestion code {
|
||||
background: #e9ecef;
|
||||
padding: 2px 4px;
|
||||
border-radius: 2px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 10px;
|
||||
word-break: break-all;
|
||||
grid-column: 1 / -1;
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.msd-rss-desc {
|
||||
color: var(--msd-text-light);
|
||||
font-size: 11px;
|
||||
grid-column: 1 / -1;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.msd-feed-tips {
|
||||
background: white;
|
||||
padding: 12px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-feed-tips ul {
|
||||
margin: 8px 0 0 0;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.msd-feed-tips li {
|
||||
font-size: 12px;
|
||||
color: var(--msd-text-light);
|
||||
line-height: 1.4;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.msd-source-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.msd-source-options {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.msd-rss-suggestion {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.msd-modal-content {
|
||||
margin: 20px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.msd-news-source-item.error {
|
||||
border-color: var(--msd-danger);
|
||||
background: #fff5f5;
|
||||
}
|
||||
|
||||
.msd-news-url.error {
|
||||
border-color: var(--msd-danger);
|
||||
}
|
||||
</style>
|
|
@ -1,356 +0,0 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$quick_links = get_site_option('msd_quick_links', []);
|
||||
?>
|
||||
|
||||
<div id="msd-quick-links-modal" class="msd-modal" style="display: none;">
|
||||
<div class="msd-modal-content">
|
||||
<div class="msd-modal-header">
|
||||
<h3><?php _e('Configure Quick Links', 'wp-multisite-dashboard'); ?></h3>
|
||||
<button type="button" class="msd-modal-close" onclick="MSD.hideQuickLinksModal()">×</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-body">
|
||||
<div id="msd-quick-links-editor">
|
||||
<?php if (!empty($quick_links)): ?>
|
||||
<?php foreach ($quick_links as $index => $link): ?>
|
||||
<div class="msd-link-item">
|
||||
<div class="msd-link-row">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('Link Title', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($link['title']); ?>"
|
||||
class="msd-link-title"
|
||||
required>
|
||||
<input type="url"
|
||||
placeholder="https://example.com"
|
||||
value="<?php echo esc_url($link['url']); ?>"
|
||||
class="msd-link-url"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="msd-link-options">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_attr_e('dashicons-admin-home or 🏠', 'wp-multisite-dashboard'); ?>"
|
||||
value="<?php echo esc_attr($link['icon']); ?>"
|
||||
class="msd-link-icon"
|
||||
title="<?php esc_attr_e('Icon (Dashicon class or emoji)', 'wp-multisite-dashboard'); ?>">
|
||||
|
||||
<label class="msd-checkbox-label">
|
||||
<input type="checkbox"
|
||||
class="msd-link-newtab"
|
||||
<?php checked(!empty($link['new_tab'])); ?>>
|
||||
<?php _e('Open in new tab', 'wp-multisite-dashboard'); ?>
|
||||
</label>
|
||||
|
||||
<button type="button" class="msd-remove-link">
|
||||
<?php _e('Remove', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="msd-add-link-section">
|
||||
<button type="button" id="msd-add-link" class="button button-secondary">
|
||||
<span class="dashicons dashicons-plus-alt"></span>
|
||||
<?php _e('Add Link', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="msd-quick-links-help">
|
||||
<h4><?php _e('Icon Options', 'wp-multisite-dashboard'); ?></h4>
|
||||
|
||||
<div class="msd-icon-types">
|
||||
<div class="msd-icon-type-section">
|
||||
<h5><?php _e('WordPress Dashicons', 'wp-multisite-dashboard'); ?></h5>
|
||||
<div class="msd-icon-examples">
|
||||
<div class="msd-icon-example">
|
||||
<span class="dashicons dashicons-admin-home"></span>
|
||||
<code>dashicons-admin-home</code>
|
||||
<span><?php _e('Home', 'wp-multisite-dashboard'); ?></span>
|
||||
</div>
|
||||
<div class="msd-icon-example">
|
||||
<span class="dashicons dashicons-chart-bar"></span>
|
||||
<code>dashicons-chart-bar</code>
|
||||
<span><?php _e('Analytics', 'wp-multisite-dashboard'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-icon-type-section">
|
||||
<h5><?php _e('Emojis', 'wp-multisite-dashboard'); ?></h5>
|
||||
<div class="msd-icon-examples">
|
||||
<div class="msd-icon-example">
|
||||
<span class="msd-emoji">🏠</span>
|
||||
<code>🏠</code>
|
||||
<span><?php _e('Home', 'wp-multisite-dashboard'); ?></span>
|
||||
</div>
|
||||
<div class="msd-icon-example">
|
||||
<span class="msd-emoji">⚙️</span>
|
||||
<code>⚙️</code>
|
||||
<span><?php _e('Settings', 'wp-multisite-dashboard'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="description">
|
||||
<strong><?php _e('Dashicons:', 'wp-multisite-dashboard'); ?></strong> <?php _e('Built into WordPress, always available. Use format:', 'wp-multisite-dashboard'); ?> <code>dashicons-icon-name</code><br>
|
||||
<strong><?php _e('Emojis:', 'wp-multisite-dashboard'); ?></strong> <?php _e('Copy and paste emoji directly. Works on all devices.', 'wp-multisite-dashboard'); ?>
|
||||
</p>
|
||||
|
||||
<p class="description">
|
||||
<?php printf(__('Find more Dashicons at %s', 'wp-multisite-dashboard'), '<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">developer.wordpress.org/resource/dashicons/</a>'); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="msd-modal-footer">
|
||||
<button type="button" class="button button-primary" onclick="MSD.saveQuickLinks()">
|
||||
<?php _e('Save Links', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.hideQuickLinksModal()">
|
||||
<?php _e('Cancel', 'wp-multisite-dashboard'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.msd-modal-intro {
|
||||
margin-bottom: 20px;
|
||||
padding: 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-modal-intro p {
|
||||
margin: 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.msd-link-item {
|
||||
margin-bottom: 16px;
|
||||
padding: 16px;
|
||||
background: var(--msd-bg);
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-link-item:hover {
|
||||
border-color: var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-link-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.msd-link-options {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.msd-link-title,
|
||||
.msd-link-url,
|
||||
.msd-link-icon {
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--msd-border);
|
||||
border-radius: var(--msd-radius-small);
|
||||
font-size: 14px;
|
||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-link-title:focus,
|
||||
.msd-link-url:focus,
|
||||
.msd-link-icon:focus {
|
||||
outline: none;
|
||||
border-color: var(--msd-primary);
|
||||
box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
|
||||
}
|
||||
|
||||
.msd-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: var(--msd-text);
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.msd-checkbox-label input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.msd-add-link-section {
|
||||
text-align: center;
|
||||
margin: 24px 0;
|
||||
padding: 16px;
|
||||
border: 2px dashed var(--msd-border);
|
||||
border-radius: var(--msd-radius);
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.msd-add-link-section:hover {
|
||||
border-color: var(--msd-primary);
|
||||
}
|
||||
|
||||
#msd-add-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.msd-quick-links-help {
|
||||
margin-top: 24px;
|
||||
padding: 16px;
|
||||
background: #f8f9fa;
|
||||
border-radius: var(--msd-radius);
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-quick-links-help h4 {
|
||||
margin: 0 0 16px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.msd-icon-types {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.msd-icon-type-section h5 {
|
||||
margin: 0 0 12px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-icon-examples {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.msd-icon-example {
|
||||
display: grid;
|
||||
grid-template-columns: 24px 1fr auto;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
background: white;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-icon-example .dashicons {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: var(--msd-primary);
|
||||
}
|
||||
|
||||
.msd-icon-example .msd-emoji {
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.msd-icon-example code {
|
||||
background: #e9ecef;
|
||||
padding: 2px 4px;
|
||||
border-radius: 2px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.msd-icon-example span:last-child {
|
||||
color: var(--msd-text-light);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.msd-reorder-tip {
|
||||
margin-top: 20px;
|
||||
padding: 12px;
|
||||
background: #e7f3ff;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid #2196f3;
|
||||
}
|
||||
|
||||
.msd-reorder-tip h5 {
|
||||
margin: 0 0 8px 0;
|
||||
color: var(--msd-text);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.msd-quick-links-help .description {
|
||||
margin: 12px 0 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--msd-text-light);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.msd-quick-links-help .description:last-child {
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.msd-quick-links-help a {
|
||||
color: var(--msd-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.msd-quick-links-help a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.msd-link-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.msd-link-options {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.msd-icon-examples {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.msd-modal-content {
|
||||
margin: 20px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.msd-link-item.error {
|
||||
border-color: var(--msd-danger);
|
||||
background: #fff5f5;
|
||||
}
|
||||
|
||||
.msd-link-url.error {
|
||||
border-color: var(--msd-danger);
|
||||
}
|
||||
</style>
|
|
@ -1,90 +1,159 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
if (!defined("ABSPATH")) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['updated']) && $_GET['updated'] === 'true') {
|
||||
echo '<div class="notice notice-success is-dismissible"><p>' . __('Settings saved successfully!', 'wp-multisite-dashboard') . '</p></div>';
|
||||
if (isset($_GET["updated"]) && $_GET["updated"] === "true") {
|
||||
echo '<div class="notice notice-success is-dismissible"><p>' .
|
||||
__("Settings saved successfully!", "wp-multisite-dashboard") .
|
||||
"</p></div>";
|
||||
}
|
||||
|
||||
$plugin_core = WP_MSD_Plugin_Core::get_instance();
|
||||
$enabled_widgets = $plugin_core->get_enabled_widgets();
|
||||
$settings_manager = new WP_MSD_Settings_Manager();
|
||||
|
||||
$widget_options = [
|
||||
"msd_network_overview" => __("Network Overview", "wp-multisite-dashboard"),
|
||||
"msd_quick_site_management" => __(
|
||||
"Quick Site Management",
|
||||
"wp-multisite-dashboard"
|
||||
),
|
||||
"msd_storage_performance" => __("Storage Usage", "wp-multisite-dashboard"),
|
||||
"msd_server_info" => __("Server Information", "wp-multisite-dashboard"),
|
||||
"msd_quick_links" => __("Quick Links", "wp-multisite-dashboard"),
|
||||
"msd_version_info" => __("Version Information", "wp-multisite-dashboard"),
|
||||
"msd_custom_news" => __("Network News", "wp-multisite-dashboard"),
|
||||
"msd_user_management" => __("User Management", "wp-multisite-dashboard"),
|
||||
"msd_contact_info" => __("Contact Information", "wp-multisite-dashboard"),
|
||||
"msd_last_edits" => __("Recent Network Activity", "wp-multisite-dashboard"),
|
||||
"msd_todo_widget" => __("Todo List", "wp-multisite-dashboard"),
|
||||
];
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1><?php echo esc_html( get_admin_page_title() ); ?>
|
||||
<h1><?php echo esc_html(get_admin_page_title()); ?>
|
||||
<span style="font-size: 13px; padding-left: 10px;">
|
||||
<?php printf( esc_html__( 'Version: %s', 'wp-multisite-dashboard' ), esc_html( WP_MSD_VERSION ) ); ?>
|
||||
<?php printf(
|
||||
esc_html__("Version: %s", "wp-multisite-dashboard"),
|
||||
esc_html(WP_MSD_VERSION)
|
||||
); ?>
|
||||
</span>
|
||||
<a href="https://wpmultisite.com/document/wp-multisite-dashboard" target="_blank" class="button button-secondary" style="margin-left: 10px;">
|
||||
<?php esc_html_e( 'Documentation', 'wp-multisite-dashboard' ); ?>
|
||||
<?php esc_html_e("Documentation", "wp-multisite-dashboard"); ?>
|
||||
</a>
|
||||
<a href="https://wpmultisite.com/support/" target="_blank" class="button button-secondary">
|
||||
<?php esc_html_e( 'Support', 'wp-multisite-dashboard' ); ?>
|
||||
<?php esc_html_e("Support", "wp-multisite-dashboard"); ?>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<div class="msd-card">
|
||||
<h2><?php _e('Plugin Widget Configuration', 'wp-multisite-dashboard'); ?></h2>
|
||||
<p><?php _e('Enable or disable custom dashboard widgets provided by this plugin.', 'wp-multisite-dashboard'); ?></p>
|
||||
<h2><?php _e(
|
||||
"Plugin Widget Configuration",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h2>
|
||||
<p><?php _e(
|
||||
"Enable or disable custom dashboard widgets provided by this plugin.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field('msd_settings', 'msd_settings_nonce'); ?>
|
||||
<?php wp_nonce_field("msd_settings", "msd_settings_nonce"); ?>
|
||||
|
||||
<div class="msd-settings-grid">
|
||||
<?php foreach ($widget_options as $widget_id => $widget_name): ?>
|
||||
<?php foreach (
|
||||
$widget_options
|
||||
as $widget_id => $widget_name
|
||||
): ?>
|
||||
<div class="msd-widget-toggle">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="widgets[<?php echo esc_attr($widget_id); ?>]"
|
||||
name="widgets[<?php echo esc_attr(
|
||||
$widget_id
|
||||
); ?>]"
|
||||
value="1"
|
||||
<?php checked(!empty($enabled_widgets[$widget_id])); ?>
|
||||
<?php checked(
|
||||
!empty($enabled_widgets[$widget_id])
|
||||
); ?>
|
||||
/>
|
||||
<?php echo esc_html($widget_name); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
<?php echo $settings_manager->get_widget_description($widget_id); ?>
|
||||
<?php echo $settings_manager->get_widget_description(
|
||||
$widget_id
|
||||
); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h3><?php _e('System & Third-Party Widgets', 'wp-multisite-dashboard'); ?></h3>
|
||||
<p><?php _e('Control the display of WordPress system widgets and widgets from other plugins.', 'wp-multisite-dashboard'); ?></p>
|
||||
<h3><?php _e(
|
||||
"System & Third-Party Widgets",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h3>
|
||||
<p><?php _e(
|
||||
"Control the display of WordPress system widgets and widgets from other plugins.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
|
||||
<?php
|
||||
$available_widgets = $settings_manager->get_available_system_widgets();
|
||||
$disabled_widgets = get_site_option('msd_disabled_system_widgets', []);
|
||||
$disabled_widgets = get_site_option(
|
||||
"msd_disabled_system_widgets",
|
||||
[]
|
||||
);
|
||||
|
||||
if (!empty($available_widgets)):
|
||||
?>
|
||||
if (!empty($available_widgets)): ?>
|
||||
<div class="msd-system-widgets-grid">
|
||||
<?php
|
||||
$system_widgets = array_filter($available_widgets, function($widget) {
|
||||
return $widget['is_system'];
|
||||
});
|
||||
$system_widgets = array_filter(
|
||||
$available_widgets,
|
||||
function ($widget) {
|
||||
return $widget["is_system"] ?? false;
|
||||
}
|
||||
);
|
||||
|
||||
$third_party_widgets = array_filter($available_widgets, function($widget) {
|
||||
return !$widget['is_system'] && !$widget['is_custom'];
|
||||
});
|
||||
$third_party_widgets = array_filter(
|
||||
$available_widgets,
|
||||
function ($widget) {
|
||||
return !($widget["is_system"] ?? false) &&
|
||||
!($widget["is_custom"] ?? false);
|
||||
}
|
||||
);
|
||||
?>
|
||||
|
||||
<?php if (!empty($system_widgets)): ?>
|
||||
<div class="msd-widget-section">
|
||||
<h4><?php _e('WordPress System Widgets', 'wp-multisite-dashboard'); ?></h4>
|
||||
<?php foreach ($system_widgets as $widget_id => $widget_data): ?>
|
||||
<h4><?php _e(
|
||||
"WordPress System Widgets",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h4>
|
||||
<?php foreach (
|
||||
$system_widgets
|
||||
as $widget_id => $widget_data
|
||||
): ?>
|
||||
<div class="msd-widget-toggle">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="system_widgets[<?php echo esc_attr($widget_id); ?>]"
|
||||
name="system_widgets[<?php echo esc_attr(
|
||||
$widget_id
|
||||
); ?>]"
|
||||
value="1"
|
||||
<?php checked(!in_array($widget_id, $disabled_widgets)); ?>
|
||||
<?php checked(
|
||||
!in_array(
|
||||
$widget_id,
|
||||
$disabled_widgets
|
||||
)
|
||||
); ?>
|
||||
/>
|
||||
<?php echo esc_html($widget_data['title']); ?>
|
||||
<span class="msd-widget-meta">(<?php echo esc_html($widget_data['context']); ?>)</span>
|
||||
<?php echo esc_html(
|
||||
$widget_data["title"]
|
||||
); ?>
|
||||
<span class="msd-widget-meta">(<?php echo esc_html(
|
||||
$widget_data["context"]
|
||||
); ?>)</span>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
@ -93,86 +162,171 @@ $settings_manager = new WP_MSD_Settings_Manager();
|
|||
|
||||
<?php if (!empty($third_party_widgets)): ?>
|
||||
<div class="msd-widget-section">
|
||||
<h4><?php _e('Third-Party Plugin Widgets', 'wp-multisite-dashboard'); ?></h4>
|
||||
<?php foreach ($third_party_widgets as $widget_id => $widget_data): ?>
|
||||
<h4><?php _e(
|
||||
"Third-Party Plugin Widgets",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h4>
|
||||
<?php foreach (
|
||||
$third_party_widgets
|
||||
as $widget_id => $widget_data
|
||||
): ?>
|
||||
<div class="msd-widget-toggle">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="system_widgets[<?php echo esc_attr($widget_id); ?>]"
|
||||
name="system_widgets[<?php echo esc_attr(
|
||||
$widget_id
|
||||
); ?>]"
|
||||
value="1"
|
||||
<?php checked(!in_array($widget_id, $disabled_widgets)); ?>
|
||||
<?php checked(
|
||||
!in_array(
|
||||
$widget_id,
|
||||
$disabled_widgets
|
||||
)
|
||||
); ?>
|
||||
/>
|
||||
<?php echo esc_html($widget_data['title']); ?>
|
||||
<span class="msd-widget-meta">(<?php echo esc_html($widget_data['context']); ?>)</span>
|
||||
<?php echo esc_html(
|
||||
$widget_data["title"]
|
||||
); ?>
|
||||
<span class="msd-widget-meta">(<?php echo esc_html(
|
||||
$widget_data["context"]
|
||||
); ?>)</span>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($third_party_widgets)): ?>
|
||||
<div class="msd-widget-section">
|
||||
<h4><?php _e('Third-Party Plugin Widgets', 'wp-multisite-dashboard'); ?></h4>
|
||||
<h4><?php _e(
|
||||
"Third-Party Plugin Widgets",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></h4>
|
||||
<div class="msd-no-third-party">
|
||||
<p><?php _e('No third-party widgets detected yet.', 'wp-multisite-dashboard'); ?></p>
|
||||
<p class="description"><?php _e('Third-party widgets are automatically detected when you visit the network dashboard. If you have plugins that add dashboard widgets, visit the dashboard first, then return here to see them.', 'wp-multisite-dashboard'); ?></p>
|
||||
<a href="<?php echo network_admin_url(); ?>" class="button button-secondary">
|
||||
<?php _e('Visit Network Dashboard', 'wp-multisite-dashboard'); ?>
|
||||
</a>
|
||||
<p><?php _e(
|
||||
"No third-party widgets detected yet.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
<p class="description"><?php _e(
|
||||
"Third-party widgets are automatically detected when you visit the network dashboard. If you have plugins that add dashboard widgets, visit the dashboard first, then return here to see them.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
<div style="margin: 15px 0;">
|
||||
<a href="<?php echo network_admin_url(); ?>" class="button button-secondary">
|
||||
<?php _e(
|
||||
"Visit Network Dashboard",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</a>
|
||||
<button type="button" class="button" onclick="MSD.clearWidgetCache()">
|
||||
<?php _e(
|
||||
"Refresh Widget Detection",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="msd-no-widgets">
|
||||
<p><?php _e('No system widgets found.', 'wp-multisite-dashboard'); ?></p>
|
||||
<p><?php _e(
|
||||
"No system widgets found.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
<p><?php _e(
|
||||
"Visit the network dashboard to detect available widgets.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
<div style="margin: 15px 0;">
|
||||
<a href="<?php echo network_admin_url(); ?>" class="button button-secondary">
|
||||
<?php _e(
|
||||
"Visit Network Dashboard",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</a>
|
||||
<button type="button" class="button" onclick="MSD.clearWidgetCache()">
|
||||
<?php _e(
|
||||
"Refresh Widget Detection",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif;
|
||||
?>
|
||||
|
||||
<p class="submit">
|
||||
<?php submit_button(__('Save Widget Settings', 'wp-multisite-dashboard'), 'primary', 'submit', false); ?>
|
||||
<?php submit_button(
|
||||
__("Save Widget Settings", "wp-multisite-dashboard"),
|
||||
"primary",
|
||||
"submit",
|
||||
false
|
||||
); ?>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="msd-card">
|
||||
<h2><?php _e('Cache Management', 'wp-multisite-dashboard'); ?></h2>
|
||||
<p><?php _e('Clear cached data to refresh dashboard widgets.', 'wp-multisite-dashboard'); ?></p>
|
||||
<h2><?php _e("Cache Management", "wp-multisite-dashboard"); ?></h2>
|
||||
<p><?php _e(
|
||||
"Clear cached data to refresh dashboard widgets.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
|
||||
<div class="msd-cache-actions">
|
||||
<button type="button" class="button" onclick="MSD.clearCache('all')">
|
||||
↻
|
||||
<?php _e('Clear All Caches', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Clear All Caches", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.clearCache('network')">
|
||||
<span class="dashicons dashicons-admin-multisite"></span>
|
||||
<?php _e('Clear Network Data', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Clear Network Data", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
<button type="button" class="button" onclick="MSD.clearWidgetCache()">
|
||||
<span class="dashicons dashicons-dashboard"></span>
|
||||
<?php _e('Clear Widget Cache', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e("Clear Widget Cache", "wp-multisite-dashboard"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="description">
|
||||
<?php _e('Clearing caches will force the dashboard widgets to reload fresh data on the next page visit. Widget cache contains the list of detected third-party widgets.', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"Clearing caches will force the dashboard widgets to reload fresh data on the next page visit. Widget cache contains the list of detected third-party widgets.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="msd-card">
|
||||
<h2><?php _e('Plugin Information', 'wp-multisite-dashboard'); ?></h2>
|
||||
<p><?php _e('Current plugin status and update information.', 'wp-multisite-dashboard'); ?></p>
|
||||
<h2><?php _e("Plugin Information", "wp-multisite-dashboard"); ?></h2>
|
||||
<p><?php _e(
|
||||
"Current plugin status and update information.",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></p>
|
||||
|
||||
<div class="msd-plugin-info">
|
||||
<div class="msd-info-row">
|
||||
<span class="msd-info-label"><?php _e('Current Version:', 'wp-multisite-dashboard'); ?></span>
|
||||
<span class="msd-info-value"><?php echo esc_html(WP_MSD_VERSION); ?></span>
|
||||
<span class="msd-info-label"><?php _e(
|
||||
"Current Version:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
<span class="msd-info-value"><?php echo esc_html(
|
||||
WP_MSD_VERSION
|
||||
); ?></span>
|
||||
</div>
|
||||
|
||||
<div class="msd-info-row">
|
||||
<span class="msd-info-label"><?php _e('Update Status:', 'wp-multisite-dashboard'); ?></span>
|
||||
<span class="msd-info-label"><?php _e(
|
||||
"Update Status:",
|
||||
"wp-multisite-dashboard"
|
||||
); ?></span>
|
||||
<span class="msd-info-value" id="msd-update-status">
|
||||
<button type="button" class="button button-small" onclick="MSD.checkForUpdates()">
|
||||
<?php _e('Check for Updates', 'wp-multisite-dashboard'); ?>
|
||||
<?php _e(
|
||||
"Check for Updates",
|
||||
"wp-multisite-dashboard"
|
||||
); ?>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -375,89 +529,3 @@ $settings_manager = new WP_MSD_Settings_Manager();
|
|||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
'use strict';
|
||||
|
||||
// 确保全局 MSD 对象存在
|
||||
window.MSD = window.MSD || {};
|
||||
|
||||
// 清除缓存功能
|
||||
window.MSD.clearCache = function(type) {
|
||||
if (!confirm('Are you sure you want to clear the cache?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(msdAjax.ajaxurl, {
|
||||
action: 'msd_clear_cache',
|
||||
cache_type: type,
|
||||
nonce: msdAjax.nonce
|
||||
}, function(response) {
|
||||
if (response.success) {
|
||||
alert('Cache cleared successfully!');
|
||||
} else {
|
||||
alert('Failed to clear cache: ' + (response.data || 'Unknown error'));
|
||||
}
|
||||
}).fail(function() {
|
||||
alert('Failed to clear cache due to network error.');
|
||||
});
|
||||
};
|
||||
|
||||
// 检查更新功能
|
||||
window.MSD.checkForUpdates = function() {
|
||||
var $status = $('#msd-update-status');
|
||||
var $button = $status.find('button');
|
||||
|
||||
$button.prop('disabled', true).text('Checking...');
|
||||
|
||||
$.post(msdAjax.ajaxurl, {
|
||||
action: 'msd_check_plugin_update',
|
||||
nonce: msdAjax.nonce
|
||||
}, function(response) {
|
||||
if (response.success) {
|
||||
if (response.data.version) {
|
||||
$status.html('<span class="msd-update-available">Version ' + response.data.version + ' available!</span>');
|
||||
if (response.data.details_url) {
|
||||
$status.append(' <a href="' + response.data.details_url + '" target="_blank">View Details</a>');
|
||||
}
|
||||
} else {
|
||||
$status.html('<span class="msd-update-current">Up to date</span>');
|
||||
}
|
||||
} else {
|
||||
$button.prop('disabled', false).text('Check for Updates');
|
||||
alert('Failed to check for updates: ' + (response.data || 'Unknown error'));
|
||||
}
|
||||
}).fail(function() {
|
||||
$button.prop('disabled', false).text('Check for Updates');
|
||||
alert('Failed to check for updates due to network error.');
|
||||
});
|
||||
};
|
||||
|
||||
// 清除小部件缓存功能
|
||||
window.MSD.clearWidgetCache = function() {
|
||||
if (!confirm('Are you sure you want to clear the widget cache? This will refresh the list of detected widgets.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(msdAjax.ajaxurl, {
|
||||
action: 'msd_clear_widget_cache',
|
||||
nonce: msdAjax.nonce
|
||||
}, function(response) {
|
||||
if (response.success) {
|
||||
alert('Widget cache cleared successfully! Please reload the page to see updated widgets.');
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Failed to clear widget cache: ' + (response.data || 'Unknown error'));
|
||||
}
|
||||
}).fail(function() {
|
||||
alert('Failed to clear widget cache due to network error.');
|
||||
});
|
||||
};
|
||||
|
||||
// 调试信息
|
||||
console.log('MSD Settings loaded with functions:', Object.keys(window.MSD));
|
||||
console.log('msdAjax object:', msdAjax);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue