/**
  * Prepare the table
  *
  * @since 5.0
  */
 public function prepare_items()
 {
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->items = BD_License::get_licenses();
 }
 /**
  * Parse the license key and activate it if needed.
  * If the key is invalid, then don't save it in the setting option
  *
  * @since 5.0
  * @param array $input
  * @return array
  */
 public function parse_license_input($input)
 {
     if (is_array($input) && key_exists($this->addon_code, $input)) {
         $license_code = trim($input[$this->addon_code]);
         if (!empty($license_code)) {
             if (!BD_License::has_valid_license($this->addon_name, $this->addon_code)) {
                 $activated = BD_License::activate_license($this->addon_name, $this->addon_code, $license_code);
                 if (!$activated) {
                     unset($input[$this->addon_code]);
                 }
             }
         } else {
             unset($input[$this->addon_code]);
         }
     } else {
         if (BD_License::has_valid_license($this->addon_name, $this->addon_code)) {
             $license_code = BD_License::get_license_code($this->addon_code);
             $input[$this->addon_code] = $license_code;
         }
     }
     return $input;
 }