bws_plugin_suggest_feature_banner

The Google Sitemap by BestWebSoft bws plugin suggest feature banner function.

Description

bws_plugin_suggest_feature_banner( $plugin_info, (string) $plugin_options_name, $banner_url_or_slug ); 

Parameters (3)

0. $plugin_info
The plugin info.
1. $plugin_options_name (string)
The plugin options name.
2. $banner_url_or_slug
The banner url or slug.

Usage

  1. if ( !function_exists( 'bws_plugin_suggest_feature_banner' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-sitemap-by-bestwebsoft/bws_menu/bws_functions.php'; 
  3.  
  4. // The plugin info. 
  5. $plugin_info = null; 
  6.  
  7. // The plugin options name. 
  8. $plugin_options_name = ''; 
  9.  
  10. // The banner url or slug. 
  11. $banner_url_or_slug = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bws_plugin_suggest_feature_banner($plugin_info, $plugin_options_name, $banner_url_or_slug); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bws_menu/bws_functions.php  
  1. function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) { 
  2. global $wp_version; 
  3.  
  4. $is_network_admin = is_network_admin(); 
  5.  
  6. $plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name ); 
  7.  
  8. if ( isset( $plugin_options['display_suggest_feature_banner'] ) && 0 == $plugin_options['display_suggest_feature_banner'] ) 
  9. return; 
  10.  
  11. if ( ! isset( $plugin_options['first_install'] ) ) { 
  12. $plugin_options['first_install'] = strtotime( "now" ); 
  13. $update_option = $return = true; 
  14. } elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) { 
  15. $return = true; 
  16.  
  17. if ( ! isset( $plugin_options['go_settings_counter'] ) ) { 
  18. $plugin_options['go_settings_counter'] = 1; 
  19. $update_option = $return = true; 
  20. } elseif ( 20 > $plugin_options['go_settings_counter'] ) { 
  21. $plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1; 
  22. $update_option = $return = true; 
  23.  
  24. if ( isset( $update_option ) ) { 
  25. if ( $is_network_admin ) 
  26. update_site_option( $plugin_options_name, $plugin_options ); 
  27. else 
  28. update_option( $plugin_options_name, $plugin_options ); 
  29.  
  30. if ( isset( $return ) ) 
  31. return; 
  32.  
  33. if ( isset( $_POST['bws_hide_suggest_feature_banner_' . $plugin_options_name ] ) && check_admin_referer( $plugin_info['Name'], 'bws_settings_nonce_name' ) ) { 
  34. $plugin_options['display_suggest_feature_banner'] = 0; 
  35. if ( $is_network_admin ) 
  36. update_site_option( $plugin_options_name, $plugin_options ); 
  37. else 
  38. update_option( $plugin_options_name, $plugin_options ); 
  39. return; 
  40.  
  41. if ( false == strrpos( $banner_url_or_slug, '/' ) ) { 
  42. $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png'; 
  43. } ?> 
  44. <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> 
  45. <div class="bws_banner_on_plugin_page bws_suggest_feature_banner"> 
  46. <div class="icon"> 
  47. <img title="" src="<?php echo esc_attr( $banner_url_or_slug ); ?>" alt="" /> 
  48. </div>  
  49. <div class="text"> 
  50. <strong><?php _e( 'Thank you for choosing', 'bestwebsoft' ); ?> <?php echo $plugin_info['Name']; ?> plugin!</strong><br /> 
  51. <?php _e( "If you have a feature, suggestion or idea you'd like to see in the plugin, we'd love to hear about it!", 'bestwebsoft' ); ?>  
  52. <a target="_blank" href="http://support.bestwebsoft.com/hc/en-us/requests/new"><?php _e( 'Suggest a Feature', 'bestwebsoft' ); ?></a>  
  53. </div> 
  54. <form action="" method="post"> 
  55. <button class="notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button> 
  56. <input type="hidden" name="bws_hide_suggest_feature_banner_<?php echo $plugin_options_name; ?>" value="hide" /> 
  57. <?php wp_nonce_field( $plugin_info['Name'], 'bws_settings_nonce_name' ); ?> 
  58. </form> 
  59. </div> 
  60. </div> 
  61. <?php }