Exemplo n.º 1
0
 /**
  * Add Settings link to GravityView menu
  * @return void
  */
 public function create_app_menu()
 {
     /**
      * If not multisite, always show.
      * If multisite and the plugin is network activated, show; we need to register the submenu page for the Network Admin settings to work.
      * If multisite and not network admin, we don't want the settings to show.
      * @since 1.7.6
      */
     $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || is_network_admin() && GravityView_Plugin::is_network_activated();
     /**
      * Override whether to show the Settings menu on a per-blog basis.
      * @since 1.7.6
      * @param bool $hide_if_network_activated Default: true
      */
     $show_submenu = apply_filters('gravityview/show-settings-menu', $show_submenu);
     if ($show_submenu) {
         add_submenu_page('edit.php?post_type=gravityview', __('Settings', 'gravityview'), __('Settings', 'gravityview'), $this->_capabilities_app_settings, $this->_slug . '_settings', array($this, 'app_tab_page'));
     }
 }
 /**
  * Handle whether to display notices in Multisite based on plugin activation status
  *
  * @uses GravityView_Plugin::is_network_activated
  *
  * @since 1.12
  *
  * @return bool True: show the notices; false: don't show
  */
 private function check_show_multisite_notices()
 {
     if (!is_multisite()) {
         return true;
     }
     // It's network activated but the user can't manage network plugins; they can't do anything about it.
     if (GravityView_Plugin::is_network_activated() && !is_main_site()) {
         return false;
     }
     // or they don't have admin capabilities
     if (!is_super_admin()) {
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Outputs the admin notices generated by the plugin
  *
  * @return void
  */
 public function admin_notice()
 {
     if (empty(self::$admin_notices)) {
         return;
     }
     if (GravityView_Plugin::is_network_activated() && !is_main_site()) {
         return;
     }
     //don't display a message if use has dismissed the message for this version
     self::$dismissed_notices = (array) get_transient('gravityview_dismissed_notices');
     foreach (self::$admin_notices as $notice) {
         if (false === $this->_maybe_show_notice($notice)) {
             continue;
         }
         echo '<div id="message" class="' . esc_attr($notice['class']) . '">';
         // Too cute to leave out.
         echo GravityView_Admin::get_floaty();
         if (!empty($notice['title'])) {
             echo '<h3>' . esc_html($notice['title']) . '</h3>';
         }
         echo wpautop($notice['message']);
         if (!empty($notice['dismiss'])) {
             $dismiss = esc_attr($notice['dismiss']);
             $url = esc_url(add_query_arg(array('gv-dismiss' => wp_create_nonce('dismiss'), 'notice' => $dismiss)));
             echo wpautop('<a href="' . $url . '" data-notice="' . $dismiss . '" class="button-small button button-secondary">' . esc_html__('Dismiss', 'gravityview') . '</a>');
         }
         echo '<div class="clear"></div>';
         echo '</div>';
     }
     //reset the notices handler
     self::$admin_notices = array();
 }