mirror of
https://ghproxy.net/https://github.com/stingray82/mainwp-plugin-icons.git
synced 2025-10-04 21:54:28 +08:00
Added advanced-database-cleaner-pro.png
This commit is contained in:
parent
4e5f396bad
commit
8945323235
2 changed files with 20 additions and 7 deletions
27
README.md
27
README.md
|
@ -20,20 +20,33 @@ Replace `yourusername` with your actual GitHub username or organization name.
|
|||
### Example PHP Integration
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ php
|
||||
add_filter('mainwp_before_save_cached_icons', function($cached_icons, $icon, $slug, $type, $custom_icon, $noexp) {
|
||||
add_filter('mainwp_before_save_cached_icons', function ($cached_icons, $icon, $slug, $type, $custom_icon, $noexp) {
|
||||
$json_url = 'https://raw.githubusercontent.com/stingray82/mainwp-plugin-icons/main/icons-map.json';
|
||||
$json_data = @file_get_contents($json_url);
|
||||
if (!$json_data) return $cached_icons;
|
||||
$response = wp_remote_get($json_url);
|
||||
|
||||
$icon_map = json_decode($json_data, true);
|
||||
if (!is_array($icon_map)) return $cached_icons;
|
||||
if (is_wp_error($response)) {
|
||||
return $cached_icons;
|
||||
}
|
||||
|
||||
if (isset($icon_map[$slug])) {
|
||||
$cached_icons[$slug] = $icon_map[$slug];
|
||||
$icons_map = json_decode(wp_remote_retrieve_body($response), true);
|
||||
if (!is_array($icons_map)) {
|
||||
return $cached_icons;
|
||||
}
|
||||
|
||||
foreach ($icons_map as $custom_slug => $custom_icon_url) {
|
||||
if (!isset($cached_icons[$custom_slug])) {
|
||||
$cached_icons[$custom_slug] = [
|
||||
'lasttime_cached' => time(),
|
||||
'path_custom' => '',
|
||||
'path' => urlencode($custom_icon_url),
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $cached_icons;
|
||||
}, 10, 6);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Repository Structure
|
||||
|
|
BIN
icons/advanced-database-cleaner-pro.png
Normal file
BIN
icons/advanced-database-cleaner-pro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue