Plugin Directory

Changeset 3357952


Ignore:
Timestamp:
09/08/2025 01:44:21 PM (7 months ago)
Author:
Milmor
Message:

Update to version 1.6 from GitHub

Location:
easy-dashboard
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easy-dashboard/tags/1.6/easy-dashboard.php

    r3308406 r3357952  
    22/**
    33 * Plugin Name: Easy Dashboard
    4  * Plugin URI: https://wpgov.it
     4 * Plugin URI: https://www.marcomilesi.com
    55 * Description: Refresh your WordPress dashboard with this new elegant, metro-based one.
    66 * Author: Marco Milesi
    77 * Author URI: https://marcomilesi.com
    8  * Version: 1.5
     8 * Version: 1.6
    99 * License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010 * Text Domain: easy-dashboard
     
    101101            return;
    102102        }
    103        
     103    // Ensure Dashicons are available on our custom admin page
     104    wp_enqueue_style('dashicons');
     105
    104106        wp_enqueue_style(
    105107            self::SLUG . '-admin',
     
    108110            self::VERSION
    109111        );
    110        
     112
    111113        // Inline styles as fallback if CSS file doesn't exist
    112114        $this->add_inline_styles();
     
    227229            color: ' . $colors['primary'] . ';
    228230            transition: color 0.3s ease;
     231            display: inline-block;
     232        }
     233
     234        /* Image icons (when a menu item provides an image URL) */
     235        img.<a href="http://playground.local/wp-admin/admin.php?page=telegram_main" class="easy-dashboard-box small">
     236                    <img src="" class="easy-dashboard-icon" alt="Telegram">
     237                    <p class="easy-dashboard-label">Telegram</p>
     238                </a> {
     239            max-width: 48px;
     240            max-height: 48px;
     241            width: 48px;
     242            height: 48px;
     243            display: block;
     244            margin: 0 auto 15px;
     245            object-fit: contain;
    229246        }
    230247
     
    248265        .easy-dashboard-box.small .easy-dashboard-icon {
    249266            font-size: 32px !important;
     267            margin-bottom: 10px;
     268        }
     269
     270        .easy-dashboard-box.small img.easy-dashboard-icon {
     271            width: 32px;
     272            height: 32px;
    250273            margin-bottom: 10px;
    251274        }
     
    375398        }
    376399        ';
    377         wp_add_inline_style('wp-admin', $css);
     400    // Attach our inline styles to the plugin stylesheet handle so they reliably load
     401    wp_add_inline_style(self::SLUG . '-admin', $css);
    378402    }
    379403   
     
    485509    private function render_menu_box($menu_item, $is_small = false) {
    486510        $url = $this->format_menu_link($menu_item[2]);
    487         $icon_class = isset($menu_item[6]) ? $menu_item[6] : 'dashicons-admin-generic';
     511        $raw_icon = isset($menu_item[6]) ? $menu_item[6] : '';
    488512        $label = $this->get_menu_label($menu_item);
    489513        $size_class = $is_small ? ' small' : '';
    490        
     514
     515        // Use the WP Dashboard dashicon as the default fallback for missing icons
     516        $dashicon_class = 'dashicons-dashboard';
     517
     518        if (is_string($raw_icon) && $raw_icon !== '') {
     519            // Try to find a dashicons class in the string
     520            if (preg_match('/(dashicons[-_\w]+)/', $raw_icon, $m)) {
     521                $dashicon_class = $m[1];
     522            } else {
     523                // Treat the raw value as a possible class name (clean it)
     524                $clean = preg_replace('/[^A-Za-z0-9_\- ]+/', '', $raw_icon);
     525                if (trim($clean) !== '') {
     526                    $dashicon_class = trim($clean);
     527                }
     528            }
     529        }
     530
     531        // Check if dashicon_class contains data:image base64 and reset to dashboard icon
     532        if (strpos($dashicon_class, 'base64') !== false) {
     533            $dashicon_class = 'dashicons-dashboard';
     534        }
     535
     536        // Always use dashicons class
    491537        printf(
    492538            '<a href="%s" class="easy-dashboard-box%s">
    493                 <div class="dashicons easy-dashboard-icon %s"></div>
     539                <div class="dashicons easy-dashboard-icon %s" aria-hidden="true"></div>
    494540                <p class="easy-dashboard-label">%s</p>
    495541            </a>',
    496542            esc_url(admin_url($url)),
    497543            esc_attr($size_class),
    498             esc_attr($icon_class),
     544            esc_attr($dashicon_class),
    499545            esc_html($label)
    500546        );
     
    505551     */
    506552    private function get_menu_label($menu_item) {
    507         // Only show "Commenti" for Comments and "Plugin" for Plugins
    508553        $slug = $menu_item[2];
    509         if ($slug === 'edit-comments.php' || $slug === 'plugins.php') {
    510             // Use only the first word (usually the menu title)
    511             $label = wp_strip_all_tags($menu_item[0]);
    512             // Remove anything after the first space or parenthesis
    513             $label = preg_replace('/[\s\(].*$/', '', $label);
    514             return $label;
    515         }
    516 
    517         if ($this->is_custom_post_type_menu($menu_item[2])) {
    518             $post_type = $this->get_post_type_from_slug($menu_item[2]);
     554
     555        // Keep friendly fixed labels for Comments and Plugins
     556        if ($slug === 'edit-comments.php') {
     557            return __('Comments', 'easy-dashboard');
     558        }
     559
     560        if ($slug === 'plugins.php') {
     561            return __('Plugins', 'easy-dashboard');
     562        }
     563
     564        // For custom post types, prefer the post type's plural name
     565        if ($this->is_custom_post_type_menu($slug)) {
     566            $post_type = $this->get_post_type_from_slug($slug);
    519567            $post_type_object = get_post_type_object($post_type);
    520568
     
    524572        }
    525573
    526         return wp_strip_all_tags($menu_item[0]);
     574        // Default: strip tags and remove notification counts/trailing numbers
     575        $label = wp_strip_all_tags($menu_item[0]);
     576
     577        // Remove patterns like "11 notifications" or "11 notification" (case-insensitive)
     578        $label = preg_replace('/\s*\d+\s*notifications?$/i', '', $label);
     579
     580        // Remove any trailing number left (e.g. "Yoast SEO 11")
     581        $label = preg_replace('/\s*\d+$/', '', $label);
     582
     583        // Trim whitespace and return
     584        return trim($label);
    527585    }
    528586   
  • easy-dashboard/tags/1.6/readme.txt

    r3308406 r3357952  
    44Requires at least: 3.6
    55Tested up to: 6.9
    6 Version: 1.5
    7 Stable tag: 1.5
     6Version: 1.6
     7Stable tag: 1.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3232
    3333== Changelog ==
     34
     35= 1.6 2025-09-08 =
     36* Improved code and performance
    3437
    3538= 1.5 2025-06-09 =
  • easy-dashboard/trunk/easy-dashboard.php

    r3308406 r3357952  
    22/**
    33 * Plugin Name: Easy Dashboard
    4  * Plugin URI: https://wpgov.it
     4 * Plugin URI: https://www.marcomilesi.com
    55 * Description: Refresh your WordPress dashboard with this new elegant, metro-based one.
    66 * Author: Marco Milesi
    77 * Author URI: https://marcomilesi.com
    8  * Version: 1.5
     8 * Version: 1.6
    99 * License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010 * Text Domain: easy-dashboard
     
    101101            return;
    102102        }
    103        
     103    // Ensure Dashicons are available on our custom admin page
     104    wp_enqueue_style('dashicons');
     105
    104106        wp_enqueue_style(
    105107            self::SLUG . '-admin',
     
    108110            self::VERSION
    109111        );
    110        
     112
    111113        // Inline styles as fallback if CSS file doesn't exist
    112114        $this->add_inline_styles();
     
    227229            color: ' . $colors['primary'] . ';
    228230            transition: color 0.3s ease;
     231            display: inline-block;
     232        }
     233
     234        /* Image icons (when a menu item provides an image URL) */
     235        img.<a href="http://playground.local/wp-admin/admin.php?page=telegram_main" class="easy-dashboard-box small">
     236                    <img src="" class="easy-dashboard-icon" alt="Telegram">
     237                    <p class="easy-dashboard-label">Telegram</p>
     238                </a> {
     239            max-width: 48px;
     240            max-height: 48px;
     241            width: 48px;
     242            height: 48px;
     243            display: block;
     244            margin: 0 auto 15px;
     245            object-fit: contain;
    229246        }
    230247
     
    248265        .easy-dashboard-box.small .easy-dashboard-icon {
    249266            font-size: 32px !important;
     267            margin-bottom: 10px;
     268        }
     269
     270        .easy-dashboard-box.small img.easy-dashboard-icon {
     271            width: 32px;
     272            height: 32px;
    250273            margin-bottom: 10px;
    251274        }
     
    375398        }
    376399        ';
    377         wp_add_inline_style('wp-admin', $css);
     400    // Attach our inline styles to the plugin stylesheet handle so they reliably load
     401    wp_add_inline_style(self::SLUG . '-admin', $css);
    378402    }
    379403   
     
    485509    private function render_menu_box($menu_item, $is_small = false) {
    486510        $url = $this->format_menu_link($menu_item[2]);
    487         $icon_class = isset($menu_item[6]) ? $menu_item[6] : 'dashicons-admin-generic';
     511        $raw_icon = isset($menu_item[6]) ? $menu_item[6] : '';
    488512        $label = $this->get_menu_label($menu_item);
    489513        $size_class = $is_small ? ' small' : '';
    490        
     514
     515        // Use the WP Dashboard dashicon as the default fallback for missing icons
     516        $dashicon_class = 'dashicons-dashboard';
     517
     518        if (is_string($raw_icon) && $raw_icon !== '') {
     519            // Try to find a dashicons class in the string
     520            if (preg_match('/(dashicons[-_\w]+)/', $raw_icon, $m)) {
     521                $dashicon_class = $m[1];
     522            } else {
     523                // Treat the raw value as a possible class name (clean it)
     524                $clean = preg_replace('/[^A-Za-z0-9_\- ]+/', '', $raw_icon);
     525                if (trim($clean) !== '') {
     526                    $dashicon_class = trim($clean);
     527                }
     528            }
     529        }
     530
     531        // Check if dashicon_class contains data:image base64 and reset to dashboard icon
     532        if (strpos($dashicon_class, 'base64') !== false) {
     533            $dashicon_class = 'dashicons-dashboard';
     534        }
     535
     536        // Always use dashicons class
    491537        printf(
    492538            '<a href="%s" class="easy-dashboard-box%s">
    493                 <div class="dashicons easy-dashboard-icon %s"></div>
     539                <div class="dashicons easy-dashboard-icon %s" aria-hidden="true"></div>
    494540                <p class="easy-dashboard-label">%s</p>
    495541            </a>',
    496542            esc_url(admin_url($url)),
    497543            esc_attr($size_class),
    498             esc_attr($icon_class),
     544            esc_attr($dashicon_class),
    499545            esc_html($label)
    500546        );
     
    505551     */
    506552    private function get_menu_label($menu_item) {
    507         // Only show "Commenti" for Comments and "Plugin" for Plugins
    508553        $slug = $menu_item[2];
    509         if ($slug === 'edit-comments.php' || $slug === 'plugins.php') {
    510             // Use only the first word (usually the menu title)
    511             $label = wp_strip_all_tags($menu_item[0]);
    512             // Remove anything after the first space or parenthesis
    513             $label = preg_replace('/[\s\(].*$/', '', $label);
    514             return $label;
    515         }
    516 
    517         if ($this->is_custom_post_type_menu($menu_item[2])) {
    518             $post_type = $this->get_post_type_from_slug($menu_item[2]);
     554
     555        // Keep friendly fixed labels for Comments and Plugins
     556        if ($slug === 'edit-comments.php') {
     557            return __('Comments', 'easy-dashboard');
     558        }
     559
     560        if ($slug === 'plugins.php') {
     561            return __('Plugins', 'easy-dashboard');
     562        }
     563
     564        // For custom post types, prefer the post type's plural name
     565        if ($this->is_custom_post_type_menu($slug)) {
     566            $post_type = $this->get_post_type_from_slug($slug);
    519567            $post_type_object = get_post_type_object($post_type);
    520568
     
    524572        }
    525573
    526         return wp_strip_all_tags($menu_item[0]);
     574        // Default: strip tags and remove notification counts/trailing numbers
     575        $label = wp_strip_all_tags($menu_item[0]);
     576
     577        // Remove patterns like "11 notifications" or "11 notification" (case-insensitive)
     578        $label = preg_replace('/\s*\d+\s*notifications?$/i', '', $label);
     579
     580        // Remove any trailing number left (e.g. "Yoast SEO 11")
     581        $label = preg_replace('/\s*\d+$/', '', $label);
     582
     583        // Trim whitespace and return
     584        return trim($label);
    527585    }
    528586   
  • easy-dashboard/trunk/readme.txt

    r3308406 r3357952  
    44Requires at least: 3.6
    55Tested up to: 6.9
    6 Version: 1.5
    7 Stable tag: 1.5
     6Version: 1.6
     7Stable tag: 1.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3232
    3333== Changelog ==
     34
     35= 1.6 2025-09-08 =
     36* Improved code and performance
    3437
    3538= 1.5 2025-06-09 =
Note: See TracChangeset for help on using the changeset viewer.