function plugins($wpi_settings) {

    $parseUrl = parse_url(trim(get_bloginfo('url')));
    $this_domain = trim($parseUrl['host'] ? $parseUrl['host'] : array_shift(explode('/', $parseUrl['path'], 2)));

    ?>

      <table id="wpi_premium_feature_table" cellpadding="0" cellspacing="0">
        <thead>
        <tr>
          <td colspan="2" class="wpi_premium_feature_intro">
              <span class="header"><?php _e('WP-Invoice Premium Features',WPI) ?></span>
              <p><?php _e('When purchasing the premium features you will need to specify your domain to add the license correctly.  This is your domain:',WPI); echo ' <b>'. $this_domain .'</b>'; ?></p>
              <p id="wpi_plugins_ajax_response" class="hidden"></p>
          </td>
        </tr>
        </thead>
        <?php if(!empty($wpi_settings['available_features'])) :
          foreach($wpi_settings['available_features'] as $plugin_slug => $plugin_data): ?>
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][title]" value="<?php echo $plugin_data['title']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][tagline]" value="<?php echo $plugin_data['tagline']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][image]" value="<?php echo $plugin_data['image']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][description]" value="<?php echo $plugin_data['description']; ?>" />

        <?php $installed = WPI_Functions::check_premium($plugin_slug); ?>
        <?php $active = (@$wpi_settings['installed_features'][$plugin_slug]['disabled'] != 'false' ? true : false); ?>

        <?php if($installed): ?>
        <?php /* Do this to preserve settings after page save. */ ?>
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][disabled]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['disabled']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][name]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['name']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][version]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['version']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][description]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['description']; ?>" />
        <?php endif; ?>
        <tr class="wpi_premium_feature_block">

          <td valign="top" class="wpi_premium_feature_image">
            <?php if(!empty($plugin_data['image'])) { ?>
            <a href="http://usabilitydynamics.com/products/wp-invoice/"><img src="<?php echo $plugin_data['image']; ?>" /></a>
            <?php } ?>
          </td>

          <td valign="top">
            <div class="wpi_box">
            <div class="wpi_box_header">
              <strong><?php echo $plugin_data['title']; ?></strong>
              <p><?php echo $plugin_data['tagline']; ?> <a href="https://usabilitydynamics.com/products/wp-invoice/premium/?wp_checkout_payment_domain=<?php echo $this_domain; ?>"><?php _e('[purchase feature]', WPI) ?></a>
              </p>
            </div>
            <div class="wpi_box_content">
              <p><?php echo $plugin_data['description']; ?></p>
            </div>

            <div class="wpi_box_footer clearfix">
              <?php if($installed) { ?>

                <div class="alignleft">
                <?php

                if($wpi_settings['installed_features'][$plugin_slug]['needs_higher_wpi_version'] == 'true')  {
                  printf(__('This feature is disabled because it requires WP-Invoice %1$s or higher.'), $wpi_settings['installed_features'][$plugin_slug]['minimum_wpi_version']);
                } else {
                  echo WPI_UI::checkbox("value=true&name=wpi_settings[installed_features][$plugin_slug][disabled]&label=" . __('Disable premium feature.',WPI), $wpi_settings['installed_features'][$plugin_slug]['disabled']);

                 ?>
                </div>
                <div class="alignright"><?php _e('Feature installed, using version',WPI) ?> <?php echo $wpi_settings['installed_features'][$plugin_slug]['version']; ?>.</div>
              <?php }
              } else {
                  $pr_link = 'https://usabilitydynamics.com/products/wp-invoice/premium/'; echo sprintf(__('Please visit <a href="%s">UsabilityDynamics.com</a> to purchase this feature.',WPI),$pr_link);
              } ?>
            </div>
            </div>
          </td>
        </tr>
      <?php endforeach; else: ?>
        <tr>
          <td class="wpi_features_not_found"><?php _e('There are no available premium features.', WPI); ?></td><td></td>
        </tr>
      <?php endif; ?>
      </table>

    <?php

  }
    /**
     * Plugins tab
     *
     * @param type $wpi_settings
     */
    static function plugins($wpi_settings)
    {
        $parseUrl = parse_url(trim(get_bloginfo('url')));
        $this_domain = trim($parseUrl['host'] ? $parseUrl['host'] : array_shift(explode('/', $parseUrl['path'], 2)));
        ?>
    <script type="text/javascript">
      jQuery(document).ready(function() {
        //** Check plugin updates */
        jQuery("#wpi_ajax_check_plugin_updates").click(function() {
          jQuery('.plugin_status').remove();
          jQuery.post(ajaxurl, {
            action: 'wpi_ajax_check_plugin_updates'
          }, function(data) {
            message = "<div class='plugin_status updated fade'><p>" + data + "</p></div>";
            jQuery(message).insertAfter("h2");
          });
        });
      });
    </script>

    <table class="form-table wpi_premium_feature_intro">
      <tbody>
        <tr>
          <th><?php 
        _e('Check for Updates', WPI);
        ?>
</th>
          <td>
    <?php 
        _e('Check for any premium feature updates from the Usability Dynamics Update server:', WPI);
        ?>
            <input type="button" id="wpi_ajax_check_plugin_updates" value="<?php 
        esc_attr(_e('Check Updates', WPI));
        ?>
">
          </td>
        </tr>
        <tr>
          <th><?php 
        _e('Your Domain', WPI);
        ?>
</th>
          <td>
    <?php 
        _e('When purchasing the premium features you will need to specify your domain to add the license correctly.  This is your domain:', WPI);
        echo ' <b>' . $this_domain . '</b>';
        ?>
            <div id="wpi_plugins_ajax_response" class="hidden"></div>
          </td>
        </tr>
        <!--<tr>
          <th><?php 
        _e('WP-Invoice API Key', WPI);
        ?>
 for <?php 
        echo $this_domain;
        ?>
</th>
          <td>
    <?php 
        echo WPI_UI::input("type=text&name=wpi_api_key&group=wpi_settings&value=" . (isset($wpi_settings['wpi_api_key']) ? $wpi_settings['wpi_api_key'] : ''));
        ?>
            <div class="description">
      <?php 
        _e('Some subscription based premium features require an API key that is specific to this domain and WP-Invoice. You can get this from your account on <a href="#" target="_blank">UsabilityDynamics.com</a>.', WPI);
        ?>
            </div>
          </td>
        </tr>-->
      </tbody>
    </table>

    <table id="wpi_premium_feature_table" cellpadding="0" cellspacing="0">
      <tr>
    <?php 
        if (!empty($wpi_settings['available_features'])) {
            foreach ($wpi_settings['available_features'] as $plugin_slug => $plugin_data) {
                ?>
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][title]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['title']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][tagline]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['tagline']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][image]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['image']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][description]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['description']));
                ?>
" />

        <?php 
                $installed = WPI_Functions::check_premium($plugin_slug);
                ?>
        <?php 
                $active = @$wpi_settings['installed_features'][$plugin_slug]['disabled'] != 'false' ? true : false;
                ?>

        <?php 
                if ($installed) {
                    ?>
          <?php 
                    /* Do this to preserve settings after page save. */
                    ?>
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][disabled]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['disabled']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][name]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['name']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][version]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['version']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][description]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['description']));
                    ?>
" />
        <?php 
                }
                ?>
        <tr class="wpi_premium_feature_block">

          <td valign="top" class="wpi_premium_feature_image">
            <?php 
                if (!empty($plugin_data['image'])) {
                    ?>
              <a target="_blank" href="https://usabilitydynamics.com/products/wp-invoice/"><img src="<?php 
                    echo $plugin_data['image'];
                    ?>
" /></a>
            <?php 
                }
                ?>
          </td>

          <td valign="top">
            <div class="wpi_box">
              <div class="wpi_box_header">
                <strong><?php 
                echo $plugin_data['title'];
                ?>
</strong>
                <p><?php 
                echo $plugin_data['tagline'];
                ?>
 <a target="_blank" href="https://usabilitydynamics.com/products/wp-invoice/premium-features/"><?php 
                _e('[purchase feature]', WPI);
                ?>
</a></p>
              </div>
              <div class="wpi_box_content">
                <p><?php 
                echo stripslashes($plugin_data['description']);
                ?>
</p>
              </div>
              <div class="wpi_box_footer clearfix">
              <?php 
                if ($installed) {
                    ?>
                <div class="alignleft">
                  <?php 
                    if ($wpi_settings['installed_features'][$plugin_slug]['needs_higher_wpi_version'] == 'true') {
                        printf(__('This feature is disabled because it requires WP-Invoice %1$s or higher.'), $wpi_settings['installed_features'][$plugin_slug]['minimum_wpi_version']);
                    } else {
                        echo WPI_UI::checkbox("value=true&name=wpi_settings[installed_features][{$plugin_slug}][disabled]&label=" . __('Disable premium feature.', WPI), $wpi_settings['installed_features'][$plugin_slug]['disabled']);
                        ?>
                </div>
                <div class="alignright"><?php 
                        _e('Feature installed, using version', WPI);
                        ?>
 <?php 
                        echo $wpi_settings['installed_features'][$plugin_slug]['version'];
                        ?>
.</div>
              <?php 
                    }
                } else {
                    $pr_link = 'https://usabilitydynamics.com/products/wp-invoice/premium/';
                    echo sprintf(__('Please visit <a href="%s">UsabilityDynamics.com</a> to purchase this feature.', WPI), $pr_link);
                }
                ?>
              </div>
            </div>
          </td>
        </tr>
      <?php 
            }
        } else {
            ?>
        <tr>
          <td class="wpi_features_not_found"><?php 
            _e('There are no available premium features. Try clicking Check Updates button above.', WPI);
            ?>
</td><td></td>
        </tr>
    <?php 
        }
        ?>
    </table> <?php 
    }