Exemplo n.º 1
0
 public function admin_menu()
 {
     // Ensure that if the Waltz notification bubble was showing, that it is
     // never shown again.
     if (ClefUtils::isset_REQUEST('page') === $this->settings->connect_path && $this->get_menu_badge() === _('add security')) {
         update_user_meta(get_current_user_id(), self::HIDE_USER_SETUP_BADGE, true);
     }
     if ($this->settings->multisite_disallow_settings_override()) {
         if ($this->settings->is_configured()) {
             // if the single site override of settings is not allowed
             // let's add a menu page that only lets a user connect
             // their clef account
             add_menu_page(__("Clef", 'wpclef'), __("Clef", 'wpclef'), "read", $this->settings->settings_path, array($this, 'render_clef_user_settings'), CLEF_URL . 'assets/dist/img/gradient_icon_16.png');
         }
         return;
     }
     $clef_menu_title = $this->get_clef_menu_title();
     $menu_name = $this->settings->settings_path;
     add_menu_page(__("Clef", 'wpclef'), $clef_menu_title, "manage_options", $menu_name, array($this, 'general_settings'), CLEF_URL . 'assets/dist/img/gradient_icon_16.png');
     if ($this->settings->is_configured()) {
         if (ClefUtils::user_has_clef()) {
             $name = __('Disconnect Clef account', 'wpclef');
         } else {
             $name = __('Connect Clef account', 'wpclef');
         }
         add_submenu_page($menu_name, $name, $name, 'read', self::CONNECT_CLEF_PAGE, array($this, 'render_clef_user_settings'));
     }
 }