/**
  * Content for the "status" column.
  *
  * @param  array  $item The current item.
  * @since  1.0.0
  * @return string       The content of this column.
  */
 public function column_product_status($item)
 {
     $response = '';
     if ('active' == $item['product_status']) {
         $deactivate_url = wp_nonce_url(\UsabilityDynamics\Utility::current_url(array('action' => 'deactivate-product', 'filepath' => urlencode($item['product_file_path']))), 'bulk-licenses');
         //$deactivate_url = wp_nonce_url( add_query_arg( 'action', 'deactivate-product', add_query_arg( 'filepath', $item['product_file_path'], add_query_arg( 'page', $this->page, network_admin_url( 'index.php' ) ) ) ), 'bulk-licenses' );
         $response = '<a href="' . esc_url($deactivate_url) . '" onclick="return confirm(\'' . __('Are you sure you want to deactivate the license?', $this->domain) . '\');">' . __('Deactivate', $this->domain) . '</a>' . "\n";
     } else {
         $response .= '<ul>' . "\n";
         $response .= '<li><input name="products[' . esc_attr($item['product_file_path']) . '][license_key]" id="license_key-' . esc_attr($item['product_file_path']) . '" type="text" value="" size="37" aria-required="true" placeholder="' . esc_attr(__('Place License Key here', $this->domain)) . '" /><li>' . "\n";
         if (!$this->activation_email) {
             $response .= '</ul>' . "\n";
             $response .= '<input name="products[' . esc_attr($item['product_file_path']) . '][activation_email]" type="hidden" value="" />' . "\n";
         } else {
             $response .= '<li><input name="products[' . esc_attr($item['product_file_path']) . '][activation_email]" id="activation_email-' . esc_attr($item['product_file_path']) . '" type="text" value="" size="37" aria-required="true" placeholder="' . esc_attr(__('Place Activation Email here', $this->domain)) . '" /></li>' . "\n";
             $response .= '</ul>' . "\n";
         }
     }
     return $response;
 }
 /**
  * Process the action for the admin screen.
  * @since  1.0.0
  * @return  void
  */
 public function process_request()
 {
     add_action('admin_notices', array($this, 'admin_notices'));
     $supported_actions = array('activate-products', 'deactivate-product');
     if (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], $supported_actions) || !check_admin_referer('bulk-' . 'licenses')) {
         return null;
     }
     $response = false;
     $status = 'false';
     $type = $_REQUEST['action'];
     switch ($type) {
         case 'activate-products':
             $products = array();
             if (isset($_POST['products']) && 0 < count($_POST['products'])) {
                 foreach ($_POST['products'] as $k => $v) {
                     if (!empty($v['license_key'])) {
                         $products[$k] = $v;
                     }
                 }
             }
             if (0 < count($products)) {
                 //echo "<pre>"; print_r( $products ); echo "</pre>"; die();
                 $response = $this->activate_products($products);
             } else {
                 $response = false;
                 $type = 'no-license-keys';
             }
             break;
         case 'deactivate-product':
             if (isset($_GET['filepath']) && '' != $_GET['filepath']) {
                 $response = $this->deactivate_product($_GET['filepath']);
             }
             break;
         default:
             break;
     }
     if ($response == true) {
         $status = 'true';
     }
     $redirect_url = \UsabilityDynamics\Utility::current_url(array('type' => urlencode($type), 'status' => urlencode($status)), array('action', 'filepath', '_wpnonce'));
     wp_safe_redirect($redirect_url);
     exit;
 }