Plugin Directory

Changeset 2523593


Ignore:
Timestamp:
04/29/2021 03:56:20 PM (5 years ago)
Author:
mgibbs189
Message:

Tagged 1.0.2

Location:
admin-cleanup/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin-cleanup/trunk/admin-cleanup.php

    r1961518 r2523593  
    44Plugin URI: https://facetwp.com/
    55Description: Clean up the admin sidebar menu
    6 Version: 1.0.1
     6Version: 1.0.2
    77Author: Matt Gibbs
    88License: GPLv2 or later
     
    2020
    2121    function __construct() {
    22         add_action( 'admin_init', array( $this, 'admin_init' ) );
    23         add_action( 'admin_menu', array( $this, 'admin_menu' ) );
     22        add_action( 'admin_init', [ $this, 'admin_init' ] );
     23        add_action( 'admin_menu', [ $this, 'admin_menu' ] );
    2424    }
    2525
     
    2727    function admin_init() {
    2828        if ( is_admin() ) {
    29             add_action( 'admin_head', array( $this, 'hide_menu_items' ) );
    30             add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 999 );
     29            add_action( 'admin_head', [ $this, 'hide_menu_items' ] );
     30            add_action( 'admin_bar_menu', [ $this, 'admin_bar_menu' ], 999 );
    3131        }
    3232
    3333        // Save settings
    3434        if ( isset( $_POST['item'] ) && current_user_can( 'manage_options' ) ) {
    35             $groups = get_option( 'admin_cleanup_groups', array() );
     35            $groups = get_option( 'admin_cleanup_groups', [] );
    3636
    3737            if ( ! empty( $_POST['new_group'] ) ) {
     
    5959
    6060        // Load settings & groups
    61         $settings = get_option( 'admin_cleanup_settings', array() );
    62         $groups = get_option( 'admin_cleanup_groups', array() );
     61        $settings = get_option( 'admin_cleanup_settings', [] );
     62        $groups = get_option( 'admin_cleanup_groups', [] );
    6363
    6464        if ( ! empty( $settings ) ) {
     
    7474
    7575    function admin_menu() {
    76         add_options_page( 'Admin Cleanup', 'Admin Cleanup', 'manage_options', 'admin-cleanup', array( $this, 'settings_page' ) );
     76        add_options_page( 'Admin Cleanup', 'Admin Cleanup', 'manage_options', 'admin-cleanup', [ $this, 'settings_page' ] );
    7777    }
    7878
     
    8181        global $menu, $submenu;
    8282
    83         $temp_menu = array();
     83        $temp_menu = [];
    8484        foreach ( $menu as $key => $data ) {
    8585            $id = $data[2];
     
    103103        $this->parse_menus();
    104104        if ( false !== array_search( 'move', $this->settings ) ) {
    105             $args = array(
     105            $args = [
    106106                'id'        => 'admin-cleanup',
    107107                'title'     => 'Menu',
    108108                'parent'    => false,
    109109                'href'      => '',
    110                 'meta'      => array(),
    111             );
     110                'meta'      => [],
     111            ];
    112112            $wp_admin_bar->add_node( $args );
    113113        }
    114114        foreach ( $this->groups as $group_slug => $group_name ) {
    115115            if ( false !== array_search( $group_slug, $this->settings ) ) {
    116                 $args = array(
     116                $args = [
    117117                    'id'        => 'admin-cleanup-' . $group_slug,
    118118                    'title'     => $group_name,
    119119                    'parent'    => false,
    120120                    'href'      => '',
    121                     'meta'      => array(),
    122                 );
     121                    'meta'      => [],
     122                ];
    123123                $wp_admin_bar->add_node( $args );
    124124            }
     
    135135            $the_href = menu_page_url( $the_menu[2], false );
    136136            $the_href = empty( $the_href ) ? $the_menu[2] : $the_href;
    137             $the_id = /*'ac-' . */$key;
    138 
    139             $args = array(
     137            $the_id = $key;
     138
     139            $args = [
    140140                'id'        => $the_id,
    141141                'title'     => $the_menu[0],
    142142                'parent'    => $group,
    143143                'href'      => $the_href,
    144             );
     144            ];
    145145            $wp_admin_bar->add_node( $args );
    146146
     
    150150                    $the_href = empty( $the_href ) ? $child[2] : $the_href;
    151151
    152                     $args = array(
     152                    $args = [
    153153                        'id'        => $the_id . '-' . $key,
    154154                        'title'     => $child[0],
    155155                        'parent'    => $the_id,
    156156                        'href'      => $the_href,
    157                     );
     157                    ];
    158158                    $wp_admin_bar->add_node( $args );
    159159                }
     
    219219            echo '<tr>';
    220220
    221             $choices = array_merge( array( 'show' => 'show', 'move' => 'move' ), $this->groups, array( 'hide' => 'hide' ) );
     221            $choices = array_merge( [ 'show' => 'show', 'move' => 'move' ], $this->groups, [ 'hide' => 'hide' ] );
    222222            foreach ( $choices as $choice => $choice_label ) {
    223223                $the_val = isset( $this->settings[ $data[5] ] ) ?
  • admin-cleanup/trunk/readme.txt

    r1961518 r2523593  
    33Tags: admin menu, admin bar, admin, cleanup, hide menu
    44Requires at least: 4.8
    5 Tested up to: 5.0
     5Tested up to: 5.7.1
    66Stable tag: trunk
    77License: GPLv2
     
    3232== Changelog ==
    3333
     34= 1.0.2 =
     35* Ensure WP 5.7 compatibility
     36* Switched to PHP array shorthand
     37
    3438= 1.0.1 =
    3539* Ensure WP 5.0 compatibility
Note: See TracChangeset for help on using the changeset viewer.