WordPress.org

Plugin Directory

Changeset 1704549


Ignore:
Timestamp:
07/28/17 15:40:57 (6 months ago)
Author:
vincentdubroeucq
Message:

Fixed compatibility issue with older versions of PHP.

Location:
easy-admin
Files:
7 added
2 edited

Legend:

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

    r1665573 r1704549  
    33Plugin Name: Easy Admin 
    44Description: This allows you to simply hide some admin menu items. Super simple. 
    5 Version:     1.0.0 
     5Version:     1.0.1 
    66Author:      Vincent Dubroeucq 
    77Author URI:  https://vincentdubroeucq.com 
     
    2424  
    2525You should have received a copy of the GNU General Public License 
    26 along with Armean Conseil Addon. If not, see https://www.gnu.org/licenses/gpl-2.0.html. 
     26along with Easy Admin. If not, see https://www.gnu.org/licenses/gpl-2.0.html. 
    2727*/ 
    2828defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' ); 
     
    147147 **/ 
    148148function easy_admin_get_all_menu_items(){ 
    149     if (  isset( $_GET['page'] ) && 'easy-admin' == $_GET['page']  ){ 
     149    if (  is_admin() && isset( $_GET['page'] ) && 'easy-admin' === $_GET['page']  ){ 
    150150        $all_menu_items = easy_admin_get_menu_items(); 
    151151        update_option( 'easy_admin_all_menu_items', $all_menu_items ); 
     
    188188    $menu_items = wp_list_pluck( $menu, 0, 2 ); 
    189189 
    190  
    191190    // Filter the list to remove seperators and Easy Admin itself 
    192     $menu_items = array_filter( $menu_items, 'easy_admin_items_filter', ARRAY_FILTER_USE_BOTH);  
     191    foreach ($menu_items as $slug => $name) { 
     192        if( 'easy-admin' == $slug || ! $name ){ 
     193            unset( $menu_items[$slug] ); 
     194        } 
     195    } 
     196 
    193197    return apply_filters( 'easy_admin_menu_items', $menu_items ); 
    194198     
    195199} 
    196200 
    197  
    198  
    199 /** 
    200  * Filters our menu items array to get seperators and 'Easy-admin' out of the list. 
    201  * 
    202  * @param   string    $value   Name of the list items 
    203  * @return  boolean            True to keep it, false to kill it. 
    204 **/ 
    205 function easy_admin_items_filter( $name, $slug ){ 
    206     return ! ( 'easy-admin' == $slug || ! $name ); 
    207 } 
  • easy-admin/trunk/readme.txt

    r1665574 r1704549  
    44Tags: admin-area, admin, dashboard, admin menu 
    55Requires at least: 4.0 
    6 Tested up to: 4.7.5 
    7 Stable tag: 1.0.0 
     6Tested up to: 4.8 
     7Stable tag: 1.0.1 
    88License: GPLv2 or later 
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html 
     
    3737== Changelog == 
    3838 
    39 = 1.0 = 
     39= 1.0.1 = 
     40* Initial release. 
     41 
     42= 1.0.0 = 
    4043* Initial release. 
    4144 
    4245== Frequently Asked Questions == 
    4346 
    44 = Does Easy Admin offer granular control over sub-items ? = 
     47= Does Esay Admin offer granular control over sub-items ? = 
    4548 
    4649No. Else it won't be 'Easy' anymore. Not yet. But why not later ? 
     
    4851== Upgrade Notice == 
    4952 
    50 = 1.0 = 
     53= 1.0.1 = 
     54Fixed compatibility issue with older versions of PHP. 
    5155 
     56= 1.0.0 = 
    5257Initial release. 
Note: See TracChangeset for help on using the changeset viewer.