ninja_forms_tab_addons

The Ninja Forms ninja forms tab addons function.

Description

ninja_forms_tab_addons(); 

Usage

  1. if ( !function_exists( 'ninja_forms_tab_addons' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/pages/ninja-forms-addons/tabs/addons/addons.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_tab_addons(); 
  7.  

Defined (1)

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

/deprecated/includes/admin/pages/ninja-forms-addons/tabs/addons/addons.php  
  1. function ninja_forms_tab_addons() { 
  2. // $uri = 'https://ninjaforms.com/downloads/category/ninja-forms/feed/'; 
  3. //include_once(ABSPATH . WPINC . '/feed.php'); 
  4. // $feed = fetch_feed( $uri ); 
  5.  
  6. // if (!is_wp_error( $feed ) ) : 
  7. // $items = $feed->get_items(0, 0); 
  8. // endif; 
  9.  
  10. $items = wp_remote_get( 'https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h' ); 
  11.  
  12. $items = wp_remote_retrieve_body( $items ); 
  13.  
  14. $items = json_decode( $items, true ); 
  15.  
  16. //shuffle( $items ); 
  17. foreach ($items as $item) { 
  18. $plugin_data = array(); 
  19. if( !empty( $item['plugin'] ) && file_exists( WP_PLUGIN_DIR.'/'.$item['plugin'] ) ) { 
  20. $plugin_data = get_plugin_data( WP_PLUGIN_DIR.'/'.$item['plugin'], false, true ); 
  21. $version = isset ( $plugin_data['Version'] ) ? $plugin_data['Version'] : ''; 
  22. if ( ! empty ( $version ) && $version < $item['version'] ) { 
  23. echo '<div class="error"><p>'; 
  24. echo '<strong>' . $item['title'] . '</strong> requires an update. You have version <strong>' . $version . '</strong> installed. The current version is <strong>' . $item['version'] . '</strong>.'; 
  25. echo '</p></div>'; 
  26.  
  27. $u_id = get_option( 'nf_aff', false ); 
  28. if ( !$u_id ) $u_id = apply_filters( 'ninja_forms_affiliate_id', false ); 
  29.  
  30. foreach ($items as $item) { 
  31.  
  32. $link = $item[ 'link' ]; 
  33. if ( $u_id ) { 
  34. $last_slash = strripos( $link, '/' ); 
  35. $link = substr( $link, 0, $last_slash ); 
  36. $link = urlencode( $link ); 
  37. $link = 'http://www.shareasale.com/r.cfm?u=' . $u_id . '&b=812237&m=63061&afftrack=&urllink=' . $link;  
  38.  
  39. echo '<div class="nf-extend nf-box">'; 
  40. echo '<img src="' . $item['image'] . '" />'; 
  41. echo '<h2>' . $item['title'] . '</h2>'; 
  42. echo '<div class="nf-extend-content">'; 
  43. echo '<p>' . $item['content'] . '</p>'; 
  44. echo '<div class="nf-extend-buttons">'; 
  45. if( !empty( $item['docs'] ) ) { 
  46. echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __( 'Documentation', 'ninja-forms' ) . '</a>'; 
  47. } else { 
  48. echo '<p>' . __( 'Documentation coming soon.', 'ninja-forms' ) . '</a>.</p>'; 
  49.  
  50. if( !empty( $item['plugin'] ) && file_exists( WP_PLUGIN_DIR.'/'.$item['plugin'] ) ) { 
  51. if( is_plugin_active( $item['plugin'] ) ) { 
  52. echo '<span class="button-secondary nf-button">' . __( 'Active', 'ninja-forms' ) . '</span>'; 
  53. } elseif( is_plugin_inactive( $item['plugin'] ) ) { 
  54. echo '<span class="button-secondary nf-button">' . __( 'Installed', 'ninja-forms' ) . '</span>'; 
  55. } else { 
  56. echo '<a href="' . $link . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __( 'Learn More', 'ninja-forms' ) . '</a>'; 
  57. }else{ 
  58. echo '<a href="' . $link . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __( 'Learn More', 'ninja-forms' ) . '</a>'; 
  59. echo '</div>'; 
  60.  
  61. echo '</div>'; 
  62.  
  63. echo '</div>';