/**
  * Outputs the admin notices generated by the plugin
  *
  * @uses GVCommon::has_cap()
  * @since 1.12
  *
  * @return void
  */
 public function admin_notice()
 {
     /**
      * @filter `gravityview/admin/notices` Modify the notices displayed in the admin
      * @since 1.12
      */
     $notices = apply_filters('gravityview/admin/notices', self::$admin_notices);
     if (empty($notices) || !$this->check_show_multisite_notices()) {
         return;
     }
     //don't display a message if use has dismissed the message for this version
     // TODO: Use get_user_meta instead of get_transient
     self::$dismissed_notices = isset($_GET['show-dismissed-notices']) ? array() : (array) get_transient('gravityview_dismissed_notices');
     $output = '';
     foreach ($notices as $notice) {
         // If the user doesn't have the capability to see the warning
         if (isset($notice['cap']) && false === GVCommon::has_cap($notice['cap'])) {
             do_action('gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice);
             continue;
         }
         if (true === $this->is_notice_dismissed($notice)) {
             do_action('gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice);
             continue;
         }
         $output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class($notice['class']) . '">';
         // Too cute to leave out.
         $output .= gravityview_get_floaty();
         if (!empty($notice['title'])) {
             $output .= '<h3>' . esc_html($notice['title']) . '</h3>';
         }
         $message = isset($notice['message']) ? $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)));
             $align = is_rtl() ? 'alignleft' : 'alignright';
             $message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__('Dismiss', 'gravityview') . '</a></p>';
         }
         $output .= wpautop($message);
         $output .= '<div class="clear"></div>';
         $output .= '</div>';
     }
     echo $output;
     unset($output, $align, $message, $notices);
     //reset the notices handler
     self::$admin_notices = array();
 }
Esempio n. 2
0
 /**
  * Get an image of our intrepid explorer friend
  * @return string HTML image tag with floaty's cute mug on it
  */
 public static function get_floaty()
 {
     return gravityview_get_floaty();
 }
 /**
  * Outputs the admin notices generated by the plugin
  *
  * @since 1.12
  *
  * @return void
  */
 public function admin_notice()
 {
     /**
      * Modify the notices displayed
      * @since 1.12
      */
     $notices = apply_filters('gravityview/admin/notices', self::$admin_notices);
     if (empty($notices) || !$this->check_show_multisite_notices()) {
         return;
     }
     //don't display a message if use has dismissed the message for this version
     self::$dismissed_notices = isset($_GET['show-dismissed-notices']) ? array() : (array) get_transient('gravityview_dismissed_notices');
     foreach ($notices as $notice) {
         if (false === $this->_maybe_show_notice($notice)) {
             continue;
         }
         echo '<div id="message" class="notice ' . gravityview_sanitize_html_class($notice['class']) . '">';
         // Too cute to leave out.
         echo gravityview_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();
 }
    /**
     * Navigation tabs
     *
     * @access public
     * @since 1.0
     * @return void
     */
    public function tabs()
    {
        global $plugin_page;
        // Don't fetch -beta, etc.
        list($display_version) = explode('-', GravityView_Plugin::version);
        $selected = !empty($plugin_page) ? $plugin_page : 'gv-getting-started';
        echo gravityview_get_floaty(132);
        ?>

		<h1><?php 
        printf(esc_html__('Welcome to GravityView %s', 'gravityview'), $display_version);
        ?>
</h1>
		<div class="about-text"><?php 
        esc_html_e('Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview');
        ?>
</div>

		<h2 class="nav-tab-wrapper clear">
			<a class="nav-tab <?php 
        echo $selected == 'gv-getting-started' ? 'nav-tab-active' : '';
        ?>
" href="<?php 
        echo esc_url(admin_url(add_query_arg(array('page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php')));
        ?>
">
				<?php 
        _e("Getting Started", 'gravityview');
        ?>
			</a>
			<a class="nav-tab <?php 
        echo $selected == 'gv-changelog' ? 'nav-tab-active' : '';
        ?>
" href="<?php 
        echo esc_url(admin_url(add_query_arg(array('page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php')));
        ?>
">
				<?php 
        _e("List of Changes", 'gravityview');
        ?>
			</a>
			<a class="nav-tab <?php 
        echo $selected == 'gv-credits' ? 'nav-tab-active' : '';
        ?>
" href="<?php 
        echo esc_url(admin_url(add_query_arg(array('page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php')));
        ?>
">
				<?php 
        _e('Credits', 'gravityview');
        ?>
			</a>
		</h2>
		<?php 
    }