ngg_fs

Create a helper function for easy SDK access.

Description

ngg_fs(); 

Usage

  1. if ( !function_exists( 'ngg_fs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextgen-gallery/nggallery.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ngg_fs(); 
  7.  

Defined (1)

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

/nggallery.php  
  1. function ngg_fs() { 
  2. global $ngg_fs; 
  3.  
  4. $ngg_options = get_option( 'ngg_options' ); 
  5. $ngg_run_freemius = get_option('ngg_run_freemius', NULL); 
  6.  
  7. if ( false === $ngg_options ) { 
  8. // New plugin installation. 
  9.  
  10. if ( defined('WP_FS__DEV_MODE') && WP_FS__DEV_MODE ) { 
  11. // Always run Freemius in development mode for new plugin installs. 
  12. $run_freemius = true; 
  13. } else { 
  14. // Run Freemius code on 20% of the new installations. 
  15. // $random = rand( 1, 10 ); 
  16. // $run_freemius = ( 1 <= $random && $random <= 2 ); 
  17. // Update 2016-08: run on all new instances 
  18. $run_freemius = TRUE; 
  19.  
  20. update_option('ngg_run_freemius', $run_freemius); 
  21.  
  22. // Compare both bool or string 0/1 because get_option() may give us either 
  23. } else if ((is_bool($ngg_run_freemius) && $ngg_run_freemius) || '1' === $ngg_run_freemius) { 
  24. // If runFreemius was set, use the value. 
  25. $run_freemius = $ngg_run_freemius; 
  26. } else { 
  27. // Don't run Freemius for plugin updates. 
  28. $run_freemius = false; 
  29. if (is_null($ngg_run_freemius)) 
  30. update_option('ngg_run_freemius', FALSE); 
  31.  
  32. if ( ! $run_freemius ) { 
  33. return false; 
  34.  
  35. if ( ! isset( $ngg_fs ) ) { 
  36. // Include Freemius SDK. 
  37. require_once dirname( __FILE__ ) . '/freemius/start.php'; 
  38.  
  39. $ngg_fs = fs_dynamic_init( array( 
  40. 'id' => '266',  
  41. 'slug' => 'nextgen-gallery',  
  42. 'public_key' => 'pk_009356711cd548837f074e1ef60a4',  
  43. 'is_premium' => false,  
  44. 'has_addons' => false,  
  45. 'has_paid_plans' => false,  
  46. 'menu' => array( 
  47. 'slug' => 'nextgen-gallery',  
  48. 'account' => false,  
  49. 'contact' => false,  
  50. 'support' => false,  
  51. ),  
  52. 'permissions' => array( 
  53. 'newsletter' => true,  
  54. ),  
  55. ) ); 
  56.  
  57. /** 
  58. // Optional button override. 
  59. if ( function_exists( 'fs_override_i18n' ) ) { 
  60. fs_override_i18n( array( 
  61. 'opt-in-connect' => __('OK - I\'m in!', 'nggallery'),  
  62. ), 'nextgen-gallery' ); 
  63. */ 
  64.  
  65. // Hook to the custom message filter. 
  66. $ngg_fs->add_filter( 'connect_message', 'ngg_fs_custom_connect_message', 10, 6 ); 
  67. $ngg_fs->add_action( 'after_uninstall', 'ngg_fs_uninstall' ); 
  68.  
  69. return $ngg_fs;